Use Gemini CLI with amazee.ai¶
Gemini CLI is Google's open-source terminal AI agent. You can override its base URL to route requests through amazee.ai, giving you regional data residency and budget controls.
Prerequisites¶
- Gemini CLI installed (
npm install -g @google/gemini-cli) - An amazee.ai API key
Connect Gemini CLI to amazee.ai¶
Option 1 — Environment variables¶
Add to your shell profile (~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish):
export GEMINI_API_KEY="your-amazee-ai-api-key"
export GOOGLE_GEMINI_BASE_URL="https://llm.[your-region].amazee.ai"
Replace [your-region] with your region code (e.g. ch103, us103, de103).
Then reload your shell:
Option 2 — Settings file¶
Edit ~/.gemini/settings.json:
The base URL and API key are set via environment variables (Gemini CLI reads GOOGLE_GEMINI_BASE_URL and GEMINI_API_KEY automatically).
Start Gemini CLI¶
Switching models¶
Use the --model flag or set GEMINI_MODEL:
Or in your shell profile:
See Available Models for the full list.
Verify¶
Run a query and check my.amazee.io → Usage to confirm requests are flowing through your amazee.ai endpoint.
Troubleshooting¶
- Auth errors
- Verify
GEMINI_API_KEYis set correctly. Runecho $GEMINI_API_KEYto check. - Requests going to Google instead of amazee.ai
- Make sure
GOOGLE_GEMINI_BASE_URLis set. This variable overrides the default Gemini API endpoint. - Model not found
- Check Available Models for models available in your region. Use the exact model ID.