dylibso / dylibso/mcpx-openai-node

Feature Request: Support Gemini via OpenAI compatible API on OpenAI MCP client

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15
Forks
1
PR merge metrics
No merged PRs in 30d

Description

- So recently Gemini made their API compatible with OpenAI library. More details: https://ai.google.dev/gemini-api/docs/openai#node.js

- Ideally it just requires changing the model and baseURL. I tried making the following changes in index.js from example code at https://docs.mcp.run/tutorials/mcpx-openai-node/

```
// change baseURL after exporting gemini key instead
// const openai = new OpenAI({ apiKey: OPENAI_API_KEY });

const openai = new OpenAI({
apiKey: OPENAI_API_KEY,
baseURL: "https://generativelanguage.googleapis.com/v1beta/openai/"
});

// change the model
let response = await mcpx.chatCompletionCreate({
model: "gemini-1.5-flash", // Select your preferred model
temperature: 0,
messages,
});
```

- but seem to be getting the following error.
![image](https://github.com/user-attachments/assets/c599e084-3195-4a0b-afcd-aca158b78633)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.