halfoff.devDocs
Get a key
Integrations

Gemini CLI

Run Gemini CLI on Half Off Dev at half the official Gemini price with two environment variables, then choose a Gemini model.

Gemini CLI, Google's open-source terminal assistant, speaks the Gemini API, and Half Off Dev serves that API natively. Two environment variables move it over, after which every Gemini call is billed at half the list price. Create an API key first.

Configure it#

Export the endpoint and key, then start the CLI with a model:

Shell
export GOOGLE_GEMINI_BASE_URL=https://halfoff.dev
export GEMINI_API_KEY=$HALFOFF_API_KEY
gemini -m gemini-3.1-pro

Use the bare origin: Gemini CLI adds the API version path itself.

Or import it from the dashboard#

On API keys, choose Use in tools → Gemini CLI for these lines with your key filled in. Import with CC Switch sets up Half Off Dev as a provider in the CC Switch desktop app, models included (CC Switch has to be installed). A new key is already in the dialog; for an existing one, paste the full key, because Half Off Dev stores only a hash.

Models#

The -m flag chooses the model. Any Gemini id from GET /v1/models works, such as gemini-3.1-pro for harder problems or gemini-3-flash for quick ones. All ids are on the model list.

Fixing errors#

What you seeWhat to do
401 Missing API keyNo key is reaching Half Off Dev. Export GEMINI_API_KEY in the shell that runs gemini.
401 Invalid or revoked API keyThe key was mistyped, cut short or revoked. Paste it again or make a new one.
404 Model '...' is not availableThat id doesn't exist. Copy a Gemini id from GET /v1/models or the model list.
404 Unknown endpoint /v1/v1beta/...GOOGLE_GEMINI_BASE_URL ends in /v1. Change it to https://halfoff.dev.
402The balance is empty or the key has hit its spend cap. See Billing.

Any other status is explained in Errors.