Gemini CLI API configuration guide
A reliable Gemini CLI setup depends on three things: the correct endpoint family, a valid model ID, and a token that is stored outside your project files.
Use the matching endpoint family
Confirm whether the integration expects a Gemini-style endpoint or an OpenAI-compatible endpoint. The path and request format are not interchangeable.
Validate the model ID
Use the model name shown in the current catalog. Availability, context limits, and pricing may differ between routes even when names look similar.
Debug authentication first
A 401 or 403 usually means the token, header, endpoint, or account state is wrong. Test the same token with a minimal request before changing application code.
Monitor quota and cost
Log usage and response status together. A request that succeeds but selects an unexpected route can still create a cost or latency problem.