1. Docs
  2. Coding tools
  3. Gemini CLI

Use Gemini CLI with Airoutly

Put three lines in ~/.gemini/.env and sign in with an API key. Gemini CLI then sends its requests through Airoutly.

Base URL
https://api.airoutly.comno /v1beta
Key variable
GEMINI_API_KEY
Models
Gemini models on the models page

1. Install Gemini CLI

npm install -g @google/gemini-cli

2. Connect it to Airoutly

Create ~/.gemini/.env:

~/.gemini/.env
GOOGLE_GEMINI_BASE_URL="https://api.airoutly.com"
GEMINI_API_KEY="sk-your-key"
GEMINI_MODEL="gemini-2.5-flash"

When Gemini CLI asks how to authenticate, choose Gemini API key. The custom Base URL only applies to API-key sign-in; a Google account sign-in doesn’t go through Airoutly.

3. Choose a model

GEMINI_MODEL sets the default. For one run, use gemini -m gemini-2.5-pro.

4. Check that it works

Run gemini and send hi. The request appears in the console under Usage logs within a few seconds.

Troubleshooting

Requests still go to Google

Gemini CLI loads only the first .env it finds. A .env in your project folder or one of its parents wins over ~/.gemini/.env; add the three lines there, or remove it.

I keep my key in AIROUTLY_API_KEY

Gemini CLI only reads GEMINI_API_KEY. Add export GEMINI_API_KEY=“$AIROUTLY_API_KEY” to your shell profile instead of the line in .env.