← Documentation home

Quick Agent Access

Gemini CLI

Configuration steps

  1. Confirm that the account and API Key can use the public Gemini model. The administrator must also price the model and map it to a Gemini channel.
  2. Set these variables in the same terminal that starts Gemini CLI:
$env:GEMINI_API_KEY = "YOUR_API_KEY"
$env:GOOGLE_GEMINI_BASE_URL = "https://www.zltokens.com"
$env:GEMINI_MODEL = "PUBLIC_GEMINI_MODEL"
gemini
  1. Set GOOGLE_GEMINI_BASE_URL to the server root only. Gemini CLI calls the platform /v1beta/models/... route; do not put /v1 in this variable.
  2. Start with a short request and verify the model name, Gemini route, tokens, and deduction in usage logs.

When not to use this path

  • Gemini CLI is not a general OpenAI-compatible client.
  • If the current version does not support GOOGLE_GEMINI_BASE_URL, the request does not reach platform logs, or it returns official Gemini authentication errors, use Cline, Cherry Studio, or Codex with the OpenAI Compatible setup.

Verification and limits

  • Use GEMINI_API_KEY and a custom GOOGLE_GEMINI_BASE_URL only with gemini-api-key authentication, not Google Sign-In, Code Assist, or Vertex AI.
  • The URL must be an HTTPS root without /v1. A successful request should show /v1beta/models in usage logs; otherwise use a verified OpenAI-compatible client.

Official version reference

  • Client configuration can change by version. Before deployment, troubleshooting, or a configuration change, check [Gemini CLI configuration reference](https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md).