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:
source ~/.zshrc # or ~/.bashrc
Option 2 — Settings file
Edit ~/.gemini/settings.json:
{
"model": {
"name": "claude-sonnet-4-5"
}
}
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
cd /path/to/your/project
gemini
Switching models
Use the --model flag or set GEMINI_MODEL:
gemini --model claude-sonnet-4-5
Or in your shell profile:
export GEMINI_MODEL="claude-sonnet-4-5"
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_KEY is set correctly. Run echo $GEMINI_API_KEY to check.
Requests going to Google instead of amazee.ai
: Make sure GOOGLE_GEMINI_BASE_URL is 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.