[KDM-TEST-FIX-298] fix(ai): pass Gemini API key via header and use v1beta endpoint (#265) - #298
Conversation
…cli#265) Signed-off-by: DYNOSuprovo <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository UI Review profile: QUIET Plan: Advanced Run ID: Warning
|
There was a problem hiding this comment.
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@DYNOSuprovo The PR is clean and properly addresses the issue. Merging it as is—no further changes required. Thanks for the contribution, and looking forward to seeing more contributions from you! |
|
@all-contributors please add @DYNOSuprovo for code |
|
I've put up a pull request to add @DYNOSuprovo! 🎉 |
Description
Fixes #265.
This PR addresses the security and compatibility issues in
GoogleGeminiAIClient:?key=${this.apiKey}with HTTP header'x-goog-api-key': this.apiKey.v1->v1beta):/v1/models/...to/v1beta/models/....gemini-1.5-flash,gemini-1.5-pro, andgemini-2.0-flash) are deployed under/v1beta/and previously resulted in 404 Model Not Found errors on/v1/.config.passwordinconfigure(), throwing'API key (password) is required for google-gemini provider'when missing or empty (matching OpenAI and Anthropic provider behavior).config.customHeadersin the fetch request options.config.baseUrl(defaulting tohttps://generativelanguage.googleapis.com).src/__tests__/auth.test.tsto assert header authorization (x-goog-api-key),/v1beta/endpoint URL, and API key validation.src/__tests__/google-gemini.test.tswith 100% coverage (9/9 passing tests) verifying validation, headers, endpoint URL, query parameter absence, custom headers forwarding, and error handling.Testing
npm run buildpassed cleanly.npx vitest run src/__tests__/auth.test.ts src/__tests__/google-gemini.test.tspassed (56/56 tests passing).src/ai/google-gemini.ts.