google-gemini / google-gemini/gemini-cli

Regression: GOOGLE_API_KEY + GOOGLE_GEMINI_BASE_URL rejected with "Invalid auth method selected" in 0.44.x (worked in 0.43.0)

Open
#27,550 3 comments 2 reactions 0 assignees View on GitHub
area/security kind/bug priority/p1 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## 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

```bash
# 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
```

**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/gemini-cli@0.43.0`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.