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

# Gemini CLI

> Connect Gemini CLI to ViVi-API.

Have an API key from the [ViVi-API dashboard](https://api.viviai.cc/dashboard) ready, and confirm that its group supports your chosen model. Back up any existing configuration before merging the fields below.

## 1. Install and verify

Install **Node.js 20 or later** and npm, then run:

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

## 2. Set environment variables

> [tab] Windows PowerShell
>
> For the current terminal session:
>
> ```powershell theme={null}
> $env:GOOGLE_GEMINI_BASE_URL = "https://api.viviai.cc"
> $env:GEMINI_API_KEY = "sk-your-api-key"
> ```
>
> Optionally save them as user environment variables:
>
> ```powershell theme={null}
> [System.Environment]::SetEnvironmentVariable('GOOGLE_GEMINI_BASE_URL', 'https://api.viviai.cc', 'User')
> [System.Environment]::SetEnvironmentVariable('GEMINI_API_KEY', 'sk-your-api-key', 'User')
> ```
>
> Newly opened terminals will pick up the saved user environment variables.

> [tab] macOS / Linux
>
> For the current terminal session:
>
> ```bash theme={null}
> export GOOGLE_GEMINI_BASE_URL="https://api.viviai.cc"
> export GEMINI_API_KEY="sk-your-api-key"
> ```
>
> For Zsh, add these two `export` lines to `~/.zshrc`, then run:
>
> ```bash theme={null}
> source ~/.zshrc
> ```
>
> For Bash, add them to `~/.bashrc` and run `source ~/.bashrc`.

## 3. Launch and test

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

Choose **Gemini API Key** authentication on first launch. To change authentication later, enter `/auth` in the interactive session. You can also test without entering interactive mode:

```bash theme={null}
gemini -p "Hello, please confirm that the connection works."
```

If the default model is unavailable, run `gemini -m gemini-3-flash-preview` to select a model your account supports. The base URL environment variable takes the hostname; the client appends the Gemini API path.

See the [Integration overview](https://docs.viviai.cc/en/scenarios.md) and [FAQ](https://docs.viviai.cc/en/faq.md) for more help.


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