# Gemini CLI

> Point Google's Gemini CLI at this platform's Gemini-compatible endpoint with GOOGLE_GEMINI_BASE_URL and GEMINI_API_KEY

Source: https://qd.zsopc.com/en/docs/integrations/gemini-cli

> [Gemini CLI](https://github.com/google-gemini/gemini-cli) is Google's AI assistant for the terminal; it speaks the Gemini API. These steps were checked against Gemini CLI 0.68.0 (released 2026-11-10) and the official [configuration docs](https://geminicli.com/docs/reference/configuration/).

## Get an API key

Create one at [qd.zsopc.com/dashboard/keys](https://qd.zsopc.com/dashboard/keys) (`sk-gpushare-` plus 64 hex characters; you can re-reveal it on its detail page at any time).

## Setup

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

export GOOGLE_GEMINI_BASE_URL="https://qd.zsopc.com"   # no /v1beta
export GEMINI_API_KEY="sk-gpushare-xxx"
export GEMINI_MODEL="gemini-3.1-pro-low"
```

Put these three lines in `~/.zshrc` / `~/.bashrc`. Gemini CLI also reads `.env` files, but only the first one it finds, and in an untrusted workspace it loads only key-type variables, so the base URL may be skipped.

Then pin the auth method in `~/.gemini/settings.json` (merge it in if the file already exists):

```json
{
  "security": { "auth": { "selectedType": "gemini-api-key" } }
}
```

Run `gemini`; if the interactive UI asks how to authenticate, pick **Use Gemini API key**. Non-interactive use: `gemini -p "hello"`.

Key points:

- `GOOGLE_GEMINI_BASE_URL` takes just the domain; Gemini CLI adds the `v1beta` version itself, so requests go to `https://qd.zsopc.com/v1beta/models/{model}:...`. The address must be HTTPS.
- The variable only applies to the `gemini-api-key` auth method, which is why `selectedType` goes in settings.json; without it, non-interactive mode may fail with `Invalid auth method selected`.

## Choosing a model

Gemini CLI speaks the native Gemini protocol, so use Gemini models:

| Job | Model |
|---|---|
| Default / hard tasks | `gemini-3.1-pro-low`, `gemini-4-argon` |
| Fast, cheaper | `gemini-3.8-flash` |

Model precedence: the `-m` / `--model` flag > the `GEMINI_MODEL` environment variable > `model.name` in settings.json > the default `auto`. `auto` resolves to Google's own model names, so always name an ID from our catalog explicitly; full list in [Models](../reference/models.md).

Some of Gemini CLI's internal helper calls (completion, classification and the like) always use Google model names such as `gemini-2.5-flash-lite`. This platform maps those legacy names to the matching catalog model and bills them as that model.

## Things to know

- When a model errors, Gemini CLI asks by default whether to switch to a fallback model; the fallback is billed through this platform as well.
- `privacy.usageStatisticsEnabled` (default `true`) controls Gemini CLI's own usage statistics; set it to `false` in settings.json if you don't want them sent.
- Gemini CLI can also connect MCP servers. For this platform's image, video and music tools, see [MCP media tools](./mcp.md).

## Troubleshooting

| Symptom | What to check |
|---|---|
| Still calling Google's address / asks you to sign in | `GOOGLE_GEMINI_BASE_URL` isn't set in this terminal, or `selectedType` in settings.json isn't `gemini-api-key` |
| 401 `UNAUTHENTICATED` | Whether `GEMINI_API_KEY` holds the full `sk-gpushare-` key (76 characters) |
| 400 `NOT_FOUND` | The model ID isn't in the catalog — use a Gemini model from the table above |
| 503 `UNAVAILABLE` | The model has no channel on the native Gemini protocol — switch to a Gemini model |
| 402 `RESOURCE_EXHAUSTED` | Balance exhausted. Every key shares one account balance — top up on the [Top up page](https://qd.zsopc.com/dashboard/billing) |

Full error reference: [Gemini SDK](../sdks/gemini-sdk.md) and [Error codes](../reference/errors.md).

## Other clients

- [Claude Code](./claude-code.md) — Anthropic's terminal coding assistant
- [Codex CLI](./codex-cli.md) — OpenAI's terminal coding assistant
- [Gemini SDK](../sdks/gemini-sdk.md) — call the Gemini protocol from your own code
