For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
  • Gateway
      • Claude Code
      • Codex CLI
      • Gemini CLI
      • OpenCode
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Switch models
GatewayCoding Agents

Gemini CLI (gateway)

Was this page helpful?
Previous

OpenCode (gateway)

Next
Built with

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

Setup

1

Install Gemini CLI

$npm install -g @google/gemini-cli
2

Set environment variables

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

$# Gemini API
$export GOOGLE_GEMINI_BASE_URL="https://api.respan.ai/api/google/gemini"
$export GEMINI_API_KEY="YOUR_RESPAN_API_KEY"

Or use the Vertex AI endpoint:

$export GOOGLE_GEMINI_BASE_URL="https://api.respan.ai/api/google/vertexai/"
$export GEMINI_API_KEY="YOUR_RESPAN_API_KEY"

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

3

Run Gemini CLI

$gemini "your prompt"

All LLM calls now route through Respan.

Switch models

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

$gemini --model gemini-2.5-pro
$gemini --model gemini-2.5-flash
$gemini --model gemini-2.0-flash-exp

See the full model list.