gemini-cli - 💡(How to fix) Fix Regression: GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL rejected with "Invalid auth method selected" in 0.44.x (worked in 0.43.0)

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…

Setting GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL + GOOGLE_GENAI_USE_VERTEXAI=false to route gemini-cli through a custom proxy endpoint produces Invalid auth method selected (exit 41) in 0.44.0 and 0.44.1. This worked correctly in 0.43.0.

Root Cause

Setting GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL + GOOGLE_GENAI_USE_VERTEXAI=false to route gemini-cli through a custom proxy endpoint produces Invalid auth method selected (exit 41) in 0.44.0 and 0.44.1. This worked correctly in 0.43.0.

Fix Action

Workaround

Pin to 0.43.0: npm install -g @google/[email protected]

Code Example

# Install 0.44.0 or 0.44.1
npm install -g @google/gemini-cli@0.44.1

# Set env vars to route through a local proxy
export GOOGLE_API_KEY=proxy-token
export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8080
export GOOGLE_GENAI_USE_VERTEXAI=false
export GOOGLE_CLOUD_PROJECT=
export GOOGLE_CLOUD_LOCATION=

# Run in non-interactive mode
gemini --prompt "Hello world" --yolo
RAW_BUFFERClick to expand / collapse

Description

Setting GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL + GOOGLE_GENAI_USE_VERTEXAI=false to route gemini-cli through a custom proxy endpoint produces Invalid auth method selected (exit 41) in 0.44.0 and 0.44.1. This worked correctly in 0.43.0.

Steps to reproduce

# Install 0.44.0 or 0.44.1
npm install -g @google/[email protected]

# Set env vars to route through a local proxy
export GOOGLE_API_KEY=proxy-token
export GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8080
export GOOGLE_GENAI_USE_VERTEXAI=false
export GOOGLE_CLOUD_PROJECT=
export GOOGLE_CLOUD_LOCATION=

# Run in non-interactive mode
gemini --prompt "Hello world" --yolo

Result: Invalid auth method selected. (exit code 41)

Expected: gemini-cli should accept the API key and send requests to GOOGLE_GEMINI_BASE_URL.

What works

  • 0.43.0: Same env vars work correctly — gemini-cli accepts the key and routes through the custom base URL
  • 0.44.x with real AIza... keys: If GOOGLE_API_KEY starts with AIza, the validation passes but any non-standard key format is rejected

Environment

  • gemini-cli 0.44.0 and 0.44.1
  • Node.js 22.x
  • Ubuntu 24.04, macOS ARM64, Windows Server 2025
  • All three OS reproduce the same behavior

Context

We use GOOGLE_GEMINI_BASE_URL to route gemini-cli requests through a transport proxy for model routing (e.g., running gemini-cli against OpenAI/Azure models via a translation layer). The proxy doesn't need real Google API credentials — any token works as auth is handled by the proxy. This flow worked in 0.43.0 but broke in 0.44.0.

Workaround

Pin to 0.43.0: npm install -g @google/[email protected]

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

gemini-cli - 💡(How to fix) Fix Regression: GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL rejected with "Invalid auth method selected" in 0.44.x (worked in 0.43.0)