Connect AI1API to Gemini CLI
Gemini CLI uses the Gemini-compatible endpoint. Select a Gemini group and model that are available in the console.
Prerequisites
- Gemini CLI is installed
- An API Key is bound to an available Gemini group
Setup steps
Step 1: Set Gemini environment variables
The following example is for macOS/Linux. Copy the Windows CMD or PowerShell version from the console Use API Key dialog.
Terminal variables
export GOOGLE_GEMINI_BASE_URL="https://ai1api.com/v1beta"
export GEMINI_API_KEY="sk-your-key"
export GEMINI_MODEL="gemini-2.0-flash"Step 2: Start Gemini CLI
Open a new terminal, run gemini, and send a short prompt. Check live pricing if the selected model is unavailable.
Verify the connection
Start with the smallest request, then enable streaming and tools after the connection works.
Verification
geminiNotes
- Gemini commonly uses a /v1beta endpoint; prefer the endpoint generated by the console.
- Never commit GEMINI_API_KEY to a public repository.