Gemini CLI

Gemini CLI is Google's open-source agent for the terminal. Two environment variables point it at Synthorai, and it then calls the gateway's Gemini-native endpoint with your Synthorai key.

Before you start

Create an API key on the API keys page of the console. Copy it right away: it is only shown once.

Step 1 - Set the environment variables

export GOOGLE_GEMINI_BASE_URL="https://synthorai.io"
export GEMINI_API_KEY="sk-..."
gemini -m gemini-3-pro
⚠

Use the bare host, without /v1. Gemini CLI adds its own path.

When Gemini CLI asks how to authenticate, choose Use Gemini API key. The key is sent in the x-goog-api-key header, which the gateway accepts on its Gemini-native endpoint: /v1beta/models/{model}:generateContent and :streamGenerateContent.

Step 2 - Pick a model

Pass -m a Gemini model your key may call. The models page lists them.

Only generateContent and streamGenerateContent are served on this path. Other methods, such as countTokens and embedContent, answer 404 and are not billed.

Keep the settings in a file

Instead of exporting the variables in each shell, you can put them in ~/.gemini/.env:

# ~/.gemini/.env
GOOGLE_GEMINI_BASE_URL="https://synthorai.io"
GEMINI_API_KEY="sk-..."

Troubleshooting

401 The key is wrong, or it is not set in the shell that runs gemini.

404 on a model The model is not enabled for your key. Pick one your key may call.

/v1/v1beta in a URL Remove /v1 from GOOGLE_GEMINI_BASE_URL.

To compare what Gemini models cost, see the model price comparison.