Skip to content

Gemini CLI Setup

Gemini CLI uses the Gemini v1beta protocol. Set the Base URL to the QuotaAPI origin; the CLI appends the /v1beta route itself.

See the Gemini CLI integration overview for compatibility and use cases.

macOS and Linux

bash
export GOOGLE_GEMINI_BASE_URL="https://quotarouter.ai"
export GEMINI_API_KEY="YOUR_QUOTAAPI_KEY"
export GEMINI_MODEL="gemini-2.0-flash"

Windows Command Prompt

bat
set GOOGLE_GEMINI_BASE_URL=https://quotarouter.ai
set GEMINI_API_KEY=YOUR_QUOTAAPI_KEY
set GEMINI_MODEL=gemini-2.0-flash

Windows PowerShell

powershell
$env:GOOGLE_GEMINI_BASE_URL="https://quotarouter.ai"
$env:GEMINI_API_KEY="YOUR_QUOTAAPI_KEY"
$env:GEMINI_MODEL="gemini-2.0-flash"

GEMINI_MODEL is an example. Use a Gemini model currently exposed by the group bound to your Key. Fully restart Gemini CLI after changing the environment.

Verify the model list

bash
curl "https://quotarouter.ai/v1beta/models?key=YOUR_QUOTAAPI_KEY"

After the list succeeds, test generateContent:

bash
curl "https://quotarouter.ai/v1beta/models/gemini-2.0-flash:generateContent?key=YOUR_QUOTAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{ "text": "Reply with a short Gemini CLI test message." }]
    }],
    "generationConfig": { "maxOutputTokens": 80 }
  }'

Common errors

  • API key not valid: confirm that the credential is an enabled QuotaAPI Key.
  • model not found: check the model name, the bound group, and the console model list.
  • 404: use the origin as the Base URL and do not append /v1beta manually.
  • 403: the group bound to the Key cannot access the requested Gemini model.
  • Requests still use the old host: restart the terminal and Gemini CLI so the new environment loads.

QuotaAPI is an AI API relay service for developers and teams.