Skip to content

[codex] fix(gemini): pass custom http options to sdk#12014

Open
yzlu0917 wants to merge 1 commit intocontinuedev:mainfrom
yzlu0917:codex/issue-12008-gemini-custom-headers
Open

[codex] fix(gemini): pass custom http options to sdk#12014
yzlu0917 wants to merge 1 commit intocontinuedev:mainfrom
yzlu0917:codex/issue-12008-gemini-custom-headers

Conversation

@yzlu0917
Copy link
Copy Markdown

@yzlu0917 yzlu0917 commented Apr 3, 2026

Summary

  • pass requestOptions.headers and requestOptions.timeout into the GoogleGenAI SDK via httpOptions
  • forward custom Gemini apiBase values into the SDK so chat/stream requests use the same endpoint override as embed requests
  • add adapter tests covering custom headers, custom base URL forwarding, and the default no-httpOptions path

Why

Continue's Gemini adapter already honored custom request options for the manual embed() path, but chat and streaming requests were created through GoogleGenAI without any of the configured requestOptions.headers or custom apiBase. That meant API gateways expecting custom auth headers like x-api-key could work for one path and silently fail for the main chat path.

This change keeps the SDK-based Gemini implementation, but makes its HTTP configuration consistent with the rest of the adapter.

Validation

  • ran npm test -- src/test/gemini-adapter.vitest.ts src/test/main.test.ts in packages/openai-adapters

Closes #12008


Summary by cubic

Fixes the Gemini adapter to pass custom headers and timeouts to the @google/genai SDK and to forward a custom apiBase for chat and streaming. This makes gateway-authenticated requests work consistently across embed, chat, and stream.

  • Bug Fixes
    • Build httpOptions from requestOptions.headers and requestOptions.timeout and pass to GoogleGenAI.
    • Forward custom apiBase to the SDK (clears apiVersion) so chat/stream use the same endpoint as embeds.
    • Added tests for custom headers, base URL forwarding, and the default path without httpOptions.

Written for commit daca94d. Summary will update on new commits.

@yzlu0917 yzlu0917 requested a review from a team as a code owner April 3, 2026 05:54
@yzlu0917 yzlu0917 requested review from sestinj and removed request for a team April 3, 2026 05:54
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 3, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Provider gemini does not pass custom headers to gemini API

1 participant