> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pangolin.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini CLI

> Connect Gemini CLI to a Pangolin AI Gateway resource

Gemini CLI talks Google's native `generateContent` API, so the resource you point it at needs a Google Gemini (or Vertex AI) provider attached. See [AI Gateway Overview](/manage/ai/overview) if you haven't set that up yet.

You'll need the resource's URL (its `<endpoint>`) and its API key (`<key>`). Both are on the resource's Keys page.

<Note>
  **Public vs. private resources**

  Wherever these instructions show `<key>`, what you put there depends on the resource type:

  * **Public resource** - reachable from anywhere, so the gateway checks a [virtual API key](/manage/ai/virtual-api-keys). Copy it from the resource URL after login, the Resource Launcher more-info panel, or `https://app.pangolin.net/<org-id>/keys` (use your self-hosted dashboard URL in place of `app.pangolin.net` if you self-host).
  * **Private resource** - only reachable from devices connected to your Pangolin network, so no key is checked. You must have the [Pangolin client](/manage/clients/install-client) installed and connected. Use the literal string `none` as the key.

  Don't delete the key field for private resources. Most clients refuse to start without *some* key set, so they need an inert placeholder rather than a missing one.
</Note>

## Fastest: Pangolin CLI

[Install the Pangolin CLI](/manage/clients/install-client#quick-install-recommended) if you don't have it, then log in:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin login
```

Configure Gemini CLI against a resource:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin configure gemini
```

This prompts you to pick an organization and resource if you have more than one, fetches a key for you if the resource needs one, and writes `~/.gemini/.env` - the file Gemini CLI loads automatically on every run, regardless of which directory you start it from. To skip the prompts:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin configure gemini --resource <resource-niceid-or-domain>
```

To undo it:

```bash theme={"theme":"gruvbox-light-hard"}
pangolin configure gemini --reset
```

## Manual setup

Write `~/.gemini/.env`:

```bash theme={"theme":"gruvbox-light-hard"}
GOOGLE_GEMINI_BASE_URL=<endpoint>
GEMINI_API_KEY=<key>
```

Gemini CLI also checks a project-local `.env` first (in the current directory or a parent, up to `.git` or your home directory) before falling back to `~/.gemini/.env`, so a project-level file with the same two lines overrides this for just that project.

Or, for a one-off shell session instead of a permanent file:

```bash theme={"theme":"gruvbox-light-hard"}
export GOOGLE_GEMINI_BASE_URL=<endpoint>
export GEMINI_API_KEY=<key>
gemini
```

For a private resource, keep `GEMINI_API_KEY` in place and set it to `none`. Gemini CLI won't start without it set to something.
