---
title: "Gemini CLI (gateway)"
description: "Set up Gemini CLI with the Respan 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:

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

## Setup

<Steps>
<Step title="Install Gemini CLI">

```bash
npm install -g @google/gemini-cli
```

</Step>

<Step title="Set environment variables">

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

```bash
# 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.

</Step>

<Step title="Run Gemini CLI">

```bash
gemini "your prompt"
```

All LLM calls now route through Respan.

</Step>
</Steps>

## Switch models

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

```bash
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](https://platform.respan.ai/platform/models).
