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

# Gemini CLI

> Install Gemini CLI and redirect it to Triw's /v1beta surface.

Gemini CLI is Google's terminal agent. It calls the Gemini REST API (`/v1beta`), which Triw implements, and it accepts a base-URL override.

## Requirements

| Item | Minimum |
| - | - |
| Node | 20.0.0+ |
| OS | macOS 15+, Windows 11 24H2+, Ubuntu 20.04+ |
| RAM | 4 GB casual, 16 GB for large repositories |

## Install

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

```bash Homebrew theme={null}
brew install gemini-cli
```

```bash npx (no install) theme={null}
npx @google/gemini-cli
```

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

## Configure

```bash theme={null}
export GEMINI_API_KEY="sk-..."                          # Triw key
export GOOGLE_GEMINI_BASE_URL="https://router.triw.io"  # host only
gemini
```

Or persist both in the user settings file:

```json ~/.gemini/settings.json theme={null}
{
  "apiKey": "sk-...",
  "baseUrl": "https://router.triw.io"
}
```

`settings.json` also supports environment substitution (`"$MY_VAR"`), which keeps the key out of the file:

```json theme={null}
{ "apiKey": "$TRIW_API_KEY" }
```

## Pick a model

```bash theme={null}
gemini -m gemini-2.5-flash -p "say ready"
```

Only `gemini-*` ids are meaningful for this CLI. Other families are reachable through the OpenAI-compatible route instead.

## Verify

Run one prompt, then check **Logs** in the Triw console. An empty log means the CLI still talks to Google — the base URL variable did not reach the process.

## Troubleshooting

| Symptom | Cause | Fix |
| - | - | - |
| Calls reach Google | `GOOGLE_GEMINI_BASE_URL` not exported in that shell | Export before `gemini`, or set `baseUrl` in settings |
| `401` | Key invalid for Triw, or `GOOGLE_API_KEY` overrides | Unset `GOOGLE_API_KEY`, keep only the Triw key |
| `404` | Base URL includes `/v1beta` | Use the host only |
| Model ignored | Model id not in your group | Check `GET /v1/models` |


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