Skip to Content

Gemini CLI (gateway)

Route Gemini CLI’s LLM calls through the Respan gateway for automatic logging, caching, and model switching. Only your RESPAN_API_KEY is needed.

Paste this into your coding agent:

Help me set up the Respan gateway with the Gemini CLI integration. Follow https://www.respan.ai/docs/integrations/gateway/gemini-cli.md

Setup

Install Gemini CLI

Terminal
npm install -g @google/gemini-cli

Set environment variables

Add to your shell profile (.bashrc, .zshrc, or PowerShell $PROFILE):

Terminal
# Gemini API export GOOGLE_GEMINI_BASE_URL="https://gateway.respan.ai" export GEMINI_API_KEY="YOUR_RESPAN_API_KEY"

No separate Google API key needed. The Respan gateway handles provider authentication.

Run Gemini CLI

Terminal
gemini "your prompt"

All LLM calls now route through Respan.

Switch models

Once routed through the gateway, you can use any supported Gemini model.

Terminal
gemini --model gemini-3.5-flash gemini --model gemini-3.1-flash-lite gemini --model gemini-3.1-pro-preview

See the full model list .