Skip to content

Correct Gemini CLI LLM gateway config to proxy mode#5142

Open
yrobla wants to merge 1 commit intomainfrom
feat/llm-gemini-cli
Open

Correct Gemini CLI LLM gateway config to proxy mode#5142
yrobla wants to merge 1 commit intomainfrom
feat/llm-gemini-cli

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Apr 30, 2026

Summary

Gemini CLI has no dynamic token-command equivalent (no apiKeyHelper analogue), so it must use proxy mode like Cursor rather than direct mode.

The previous config used two invalid settings.json keys:

  • /auth/tokenCommand — not a recognised Gemini CLI field
  • /baseUrl — silently ignored as a top-level key

Replace with the correct proxy-mode keys:

  • /security/auth/selectedType = "gemini-api-key" (required so that GOOGLE_GEMINI_BASE_URL is honoured; OAuth auth ignores the override, fixed in gemini-cli v0.40.0 PR #25357)
  • /env/GEMINI_API_KEY = placeholder key (proxy does not validate it)
  • /env/GOOGLE_GEMINI_BASE_URL = local proxy address

Fixes #5141

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

API Compatibility

  • This PR does not break the v1beta1 API, OR the api-break-allowed label is applied and the migration guidance is described above.

Changes

File Change

Does this introduce a user-facing change?

Implementation plan

Approved implementation plan

Special notes for reviewers

@yrobla yrobla requested a review from Copilot April 30, 2026 14:07
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Gemini CLI integration so thv llm setup writes a valid ~/.gemini/settings.json for LLM gateway usage by switching from the previously attempted (invalid) direct-mode keys to Gemini CLI’s proxy-mode configuration.

Changes:

  • Switch Gemini CLI LLM gateway integration from direct to proxy mode.
  • Replace invalid Gemini CLI settings keys (/auth/tokenCommand, /baseUrl) with proxy-mode keys under /security/auth and /env.
  • Update the real-config integration test expectations for Gemini CLI settings content.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/client/config.go Updates Gemini CLI’s LLM gateway mode and JSON pointers/values written into ~/.gemini/settings.json.
pkg/client/llm_gateway_test.go Updates the “real production configs” test assertions to reflect the new Gemini CLI proxy-mode keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/config.go Outdated
Comment thread pkg/client/llm_gateway_test.go Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.37%. Comparing base (ac8fe8e) to head (ffef687).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5142      +/-   ##
==========================================
- Coverage   67.37%   67.37%   -0.01%     
==========================================
  Files         599      600       +1     
  Lines       60610    60632      +22     
==========================================
+ Hits        40839    40853      +14     
- Misses      16677    16685       +8     
  Partials     3094     3094              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/llm_gateway.go Outdated
Comment thread pkg/client/llm_gateway.go Outdated
Comment thread pkg/client/config.go
@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 30, 2026
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from 9cebd22 to e2db88b Compare April 30, 2026 14:47
@yrobla yrobla requested a review from Copilot April 30, 2026 14:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/config.go
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from e2db88b to b883273 Compare April 30, 2026 14:51
@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 30, 2026
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from b883273 to 2a7cd70 Compare April 30, 2026 14:59
@yrobla yrobla requested a review from Copilot April 30, 2026 14:59
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 30, 2026
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from 2a7cd70 to c2e2d2a Compare April 30, 2026 15:01
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/config.go Outdated
Comment thread pkg/client/llm_gateway_test.go
Comment thread test/e2e/cli_llm_all_clients_test.go Outdated
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from c2e2d2a to bae9163 Compare April 30, 2026 15:08
@yrobla yrobla requested a review from Copilot April 30, 2026 15:08
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/llm_gateway.go Outdated
Comment thread pkg/client/llm_gateway_test.go Outdated
Comment thread test/e2e/cli_llm_all_clients_test.go Outdated
@yrobla yrobla force-pushed the feat/llm-gemini-cli branch from bae9163 to d0c8864 Compare April 30, 2026 15:16
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 30, 2026
Gemini CLI has no dynamic token-command equivalent (no apiKeyHelper
analogue), so it must use proxy mode like Cursor rather than direct mode.

The previous config used two invalid settings.json keys:
- /auth/tokenCommand  — not a recognised Gemini CLI field
- /baseUrl            — silently ignored as a top-level key

Replace with the correct proxy-mode keys:
- /security/auth/selectedType = "gemini-api-key" (required so that
  GOOGLE_GEMINI_BASE_URL is honoured; OAuth auth ignores the override,
  fixed in gemini-cli v0.40.0 PR #25357)
- /env/GEMINI_API_KEY = placeholder key (proxy does not validate it)
- /env/GOOGLE_GEMINI_BASE_URL = local proxy address

Fixes #5141
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/client/config.go
Comment thread pkg/llmgateway/config.go
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Gemini CLI support to thv llm setup

3 participants