-
Notifications
You must be signed in to change notification settings - Fork 44
Fix Google Gemini OpenAI-compatible API integration #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Additional Findings on Google Gemini API OpenAI CompatibilityAfter further investigation, I've found some key insights about the Google Gemini API's OpenAI compatibility:
baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai'
Recommended Solution
gemini: {
keyName: 'GOOGLE_API_KEY',
docsUrl: 'https://ai.google.dev/docs',
baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
model: 'gemini-2.5-pro-exp-03-25',
factory: (model, options) => new OpenAIProvider(model, options),
}
I'll continue to look for more specific documentation on Google's OpenAI-compatible API to provide more concrete recommendations. |
Any further discussion on this @bhouston ? Really wanted to try something like mycoder with gemini 2.5 pro! |
Issue Summary
After investigating issue #390 regarding the Google Gemini API integration with mycoder, I've identified potential causes for the error.
Findings
The current implementation in
mycoder
supports using the OpenAI provider with alternative APIs through thebaseUrl
configuration, as evidenced by thexai
provider which uses the OpenAIProvider.The error in issue Not Working with Google Gemini API #390 occurs when trying to use Google's Gemini API with the OpenAI-compatible endpoint:
Potential Causes
Authentication Issues: The code is likely not passing the API key in the correct format for Google's API. Google Gemini API might require an API key to be passed differently than OpenAI.
Request Format Incompatibility: While Google advertises OpenAI compatibility, there might be subtle differences in the request format or required parameters.
Endpoint URL Structure: The endpoint URL might need to be structured differently, possibly requiring additional path components or query parameters.
Recommended Next Steps
Review Google's Gemini API documentation for their OpenAI-compatible endpoint to understand authentication requirements.
Add explicit support for Google Gemini in the provider registry, similar to how
xai
is implemented but with any Gemini-specific adjustments.Consider adding debug logging to capture the exact request being sent and any response headers to better diagnose the issue.
Create a test case specifically for the Google Gemini OpenAI-compatible API to verify the integration.
I'll continue investigating the specific requirements for Google's OpenAI-compatible API and provide further updates.
The text was updated successfully, but these errors were encountered: