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

# Gemini CLI

> Set up Google's Gemini CLI to use KiosAPI as the backend provider.

# Gemini CLI

[Gemini CLI](https://github.com/google-gemini/gemini-cli) is Google's official command-line interface for interacting with Gemini models. This guide shows you how to configure it to use KiosAPI.

## Prerequisites

* **Node.js 20+** — check with `node --version`
* A **KiosAPI API key** (starts with `sk-`) created in the **`Gemini`** group

## Get the right API key

Gemini models on KiosAPI are served through the **`Gemini`** group (0.05× multiplier):

1. Log in to the [KiosAPI Dashboard](https://kiosapi.com).
2. Go to **Console → Tokens** → **Add Token**.
3. Select the group **`Gemini`**.
4. Save and copy the key.

> [!WARNING]
>
> A key from another group cannot call Gemini models. If you get a model-not-found error, check the token's group first. See [Choosing a Token Group](https://docs.kiosapi.com/getting-started/token-groups.md).

## Installation

Install Gemini CLI globally via npm:

```bash theme={null}
npm install -g @google/gemini-cli
```

Verify the installation:

```bash theme={null}
gemini --version
```

## Current Gemini models on KiosAPI

| Model | Best for |
| - | - |
| `gemini-3.8-flash` | Daily coding and chat — recommended default |
| `gemini-3.7-flash` | Fast general tasks |
| `gemini-3.6-flash` | Lighter/fastest tier |

The authoritative list is the [Models & Pricing](https://kiosapi.com/pricing) page (filter by the `Gemini` group).

## Configuration

### 1. Set the base URL

Create `~/.gemini/.env`:

```bash theme={null}
GOOGLE_GEMINI_BASE_URL=https://kiosapi.com/
GOOGLE_API_KEY=sk-xxx
```

> [!NOTE]
>
> The base URL must end with a trailing slash `/`. Gemini CLI appends the API path after it.

### 2. Configure settings

Create `~/.gemini/settings.json`:

```json theme={null}
{
  "auth": {
    "selectedType": "api-key"
  },
  "model": "gemini-3.8-flash",
  "models": {
    "gemini-3.8-flash": {
      "name": "Gemini 3.8 Flash",
      "base_url": "https://kiosapi.com/"
    },
    "gemini-3.7-flash": {
      "name": "Gemini 3.7 Flash",
      "base_url": "https://kiosapi.com/"
    },
    "gemini-3.6-flash": {
      "name": "Gemini 3.6 Flash",
      "base_url": "https://kiosapi.com/"
    }
  }
}
```

| Setting | Description |
| - | - |
| `auth.selectedType` | Authentication method — must be `api-key` for KiosAPI, NOT Google Login |
| `model` | Default model to use |
| `models` | Model definitions with display names and base URLs |

### 3. Start Gemini CLI

```bash theme={null}
gemini
```

On first launch, if prompted to select an authentication method, choose **API key** — not Google Login. Gemini CLI will read the key from `GOOGLE_API_KEY` in `~/.gemini/.env`.

## Usage

### Interactive mode

```bash theme={null}
gemini
```

### Direct question

```bash theme={null}
gemini -p "Explain how goroutines work in Go"
```

### Switching models

Inside the interactive session:

```
/model gemini-3.6-flash
```

## Troubleshooting

### 401 Unauthorized / Invalid API key

* Ensure `GOOGLE_API_KEY` contains your KiosAPI key (`sk-...`), not a Google AI key
* Ensure `auth.selectedType` is `api-key` in `~/.gemini/settings.json`
* If the CLI still tries Google Login, remove cached auth: delete `~/.gemini/oauth_creds.json` and restart

### Model Not Found / No Available Channel

* Verify your token is in the **`Gemini`** group
* Verify the model name is current (old names like `gemini-2.5-pro` no longer exist) — check the [pricing page](https://kiosapi.com/pricing)

### Connection Error

* Ensure `GOOGLE_GEMINI_BASE_URL` is `https://kiosapi.com/` with the trailing slash
* Check your network connection

## Verify Your Setup

```bash theme={null}
gemini -p "Say hello"
```

## Need Help?

* [KiosAPI Dashboard](https://kiosapi.com)
* [Choosing a Token Group](https://docs.kiosapi.com/getting-started/token-groups.md)
* [Available Models](https://kiosapi.com/pricing)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.