gemini-cli - 💡(How to fix) Fix Voice mode cloud backend requires GEMINI_API_KEY and does not support existing CLI auth [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#26301Fetched 2026-05-01 05:52:37
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
0
Timeline (top)
mentioned ×3subscribed ×3commented ×2cross-referenced ×1

Error Message

Other CLI features work transparently for OAuth users via the existing content generator/auth path; voice mode being the exception is surprising.

RAW_BUFFERClick to expand / collapse

Voice mode's gemini-live cloud backend currently requires GEMINI_API_KEY to be set, even when the user is already fully authenticated to Gemini CLI via the default "Login with Google" flow.

That means OAuth users can't use cloud voice mode without detouring to AI Studio to generate a separate API key and adding it to ~/.gemini/.env.

Where this happens:

  • packages/core/src/voice/geminiLiveTranscriptionProvider.ts:71-76 — the Live API WebSocket is opened as wss://...?key=${apiKey} and throws if no apiKey is provided.
  • packages/cli/src/ui/hooks/useVoiceMode.ts:123-166 — sources apiKey only from config.getContentGeneratorConfig()?.apiKey or process.env['GEMINI_API_KEY'], with no fallback for the OAuth case, and surfaces "Cloud voice mode requires a GEMINI_API_KEY" instead.

Other CLI features work transparently for OAuth users via the existing content generator/auth path; voice mode being the exception is surprising.

Is this intentional, or a known gap? If a follow-up PR adding an existing-auth transcription path would be welcome, I'm happy to put one up — small and additive, leaving the Live API path unchanged for API-key users and slotting into the existing transcriptionFactory.ts.

cc @jacob314 @Abhijit-2592

extent analysis

TL;DR

The issue can be fixed by adding a fallback for OAuth users to use their existing authentication for cloud voice mode without requiring a separate GEMINI_API_KEY.

Guidance

  • Investigate modifying useVoiceMode.ts to use the existing content generator/auth path for OAuth users, similar to other CLI features.
  • Consider adding a conditional check to use the OAuth authentication token when GEMINI_API_KEY is not set.
  • Review the transcriptionFactory.ts to determine the best way to integrate the new authentication path without disrupting the existing Live API path.
  • Evaluate the feasibility of adding an optional authentication parameter to the Live API WebSocket URL to support both API key and OAuth authentication.

Example

// Example of conditional check for OAuth authentication token
const apiKey = config.getContentGeneratorConfig()?.apiKey || process.env['GEMINI_API_KEY'];
if (!apiKey && oauthToken) {
  // Use OAuth token for authentication
  const wsUrl = `wss://...?token=${oauthToken}`;
} else {
  // Use API key for authentication
  const wsUrl = `wss://...?key=${apiKey}`;
}

Notes

The proposed solution assumes that the OAuth authentication token can be used as a replacement for the GEMINI_API_KEY in the Live API WebSocket URL. Further investigation is needed to confirm this and determine the exact implementation details.

Recommendation

Apply workaround by adding a fallback for OAuth users to use their existing authentication for cloud voice mode, as this is a more immediate solution that can be implemented without disrupting the existing Live API path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING