본문으로 건너뛰기

Gemini CLI

Gemini CLI uses Google native generateContent (/v1beta). GOOGLE_GEMINI_BASE_URL is the origin without /v1beta.

Configuration example. Menu and setting names can differ slightly between Gemini CLI versions.

Shared env vars live on Connect a Coding Agent #setup.

Setup#

Set GOOGLE_GEMINI_BASE_URL=https://apirouter.pleum.ai and put the same plm_ key in GEMINI_API_KEY and GOOGLE_API_KEY. Adding /v1beta duplicates the path. pleum launch gemini sets this env.

Gemini CLI env
export PLEUM_API_KEY=plm_xxxxxxxxxxxxxxxx

# GOOGLE_GEMINI_BASE_URL is the ROOT (no /v1beta) — Gemini CLI appends /v1beta itself.
export GOOGLE_GEMINI_BASE_URL=https://apirouter.pleum.ai
export GEMINI_API_KEY=$PLEUM_API_KEY
export GOOGLE_API_KEY=$PLEUM_API_KEY

pleum launch gemini --model gemini-3.8-flash
# or, after launch: /model google/gemini-3.8-flash

Verify#

Launch with pleum launch gemini and send one turn. 401 is a bad key; 404 usually means the BASE_URL ends in /v1beta or /v1. Switch models in-session with /model google/<id>.

How it works#

This tool sends Gemini API requests (generateContent). The base URL is https://apirouter.pleum.ai without /v1beta; the tool appends /v1beta itself.

Errors#

plm_xxxxxxxxxxxxxxxx in snippets is a dummy. Replace it with a real key from the dashboard's API Keys page.

SymptomCause and fix
401 UnauthorizedThe key is wrong or disabled. Copy the plm_ key again from the dashboard's API keys page, and make sure it is not another service's key.
402 Payment RequiredYou are out of credits, or the key used up its daily, weekly or monthly budget or its monthly token limit. Top up, or check the budget and limits on your API key.
404 Not FoundThe base URL is wrong, or the model ID is not in the catalog. OpenAI-compatible tools end at /v1; Anthropic and Gemini tools take the bare origin without /v1. Do not append paths like /chat/completions yourself. If the error code is model_not_found, check the model ID.
429 Too Many RequestsThe key exceeded its per-minute request limit or the concurrent-request limit (concurrency_limit_exceeded), or the model provider's own limit was hit (upstream_rate_limited). Reduce the agent's parallel runs and check Usage limits.
model not foundThat model ID is not in the catalog. Check the exact ID with GET /v1/models, including case.

Cost & security tips#

  • Set a budget on the key. A coding agent calls the model many times per task and resends long context. Daily, weekly or monthly budgets on your API key make costs easier to predict.
  • Keep the key out of git. Make sure a key in your shell profile or config file never gets committed, and if you suspect a leak, revoke it in the dashboard and issue a new one.
  • Check where sensitive code goes. Prompts and code are sent to the provider of the model you pick. Use Data residency and PII masking to control that.