Point Gemini CLI at relay.fast
Gemini CLI is Google's open-source terminal agent. It reads an API key and a base URL from environment variables, so it can send its Gemini requests to relay.fast.
Environment variables
# macOS and Linux
export GEMINI_API_KEY=sk-your-api-key
export GOOGLE_GEMINI_BASE_URL=https://relay.fast
# Windows (PowerShell), then open a new terminal
setx GEMINI_API_KEY sk-your-api-key
setx GOOGLE_GEMINI_BASE_URL https://relay.fastThe base URL is the site root without /v1: Gemini CLI adds the /v1beta/models/... path itself. Start gemini in a new terminal. If it asks how to sign in, choose the Gemini API key option.
Choose the model
Switch models inside Gemini CLI with /model set MODEL --persist, for example /model set gemini-3.8-flash --persist. Gemini CLI speaks the Gemini API format, so use the Gemini models listed below. For Claude and GPT models use Claude Code or Codex.
One-command setup
The script configures Gemini CLI for relay.fast. It sets both variables, picks a default model and a fast helper model your key can use, and warns when GOOGLE_GENAI_USE_VERTEXAI or GOOGLE_GENAI_USE_GCA would make Gemini CLI use Google sign-in instead of the key. It asks for the API key inside the script, so the key never appears in the command or shell history. Every downloaded file is checked against a published SHA-256 checksum, and running it again can restore the previous settings.
Windows (PowerShell):
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://relay.fast/downloads/setup/install-gemini-cli-en.ps1 | iex"macOS and Linux:
curl -fsSL https://relay.fast/downloads/setup/install-gemini-cli-en.sh | bashYou can read the script before running it by opening the same URL in a browser.
Troubleshooting
- Requests still go to Google:
GOOGLE_GENAI_USE_VERTEXAIorGOOGLE_GENAI_USE_GCAis set, or the terminal was opened before the variables were saved. Remove the variable and open a new terminal. - 404: the base URL contains
/v1. Use the root URL. - Model not found: the model is not a Gemini model or the ID is misspelled.
Gemini models for Gemini CLI
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash | $1.5 / $7.5 | $0.06 / $0.3 (−96%) | $0.006 | 1.05M |
| Gemini 4 Argon | gemini-4-argon | $4 / $20 | $0.32 / $1.6 (−92%) | $0.016 | 1.05M |
Frequently asked questions
Which base URL does Gemini CLI need?
https://relay.fast, without /v1. Gemini CLI appends the Gemini API path.
Can Gemini CLI use Claude or GPT models?
No. Gemini CLI uses the Gemini API format, so pick a Gemini model from the catalog. Use Claude Code or Codex for Claude and GPT models.
Is this Google's official API?
No. relay.fast is an independent gateway with a Gemini-compatible endpoint and its own API keys.