> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/ai-gateway/ai-gateway-integration/gemini-cli.md).

# Gemini CLI

Gemini CLI is a tool that lets you interact with Gemini models through a command-line interface.

You can view [**Help Guide**](https://geminicli.com/docs/) for more details.

## Install Gemini CLI

Install Gemini CLI globally using npm:

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

After installation, the `gemini` command will be available in your terminal.

## Configuration

Gemini CLI reads its configuration from environment variables.

**Step 1: Open (or create) the environment file**

```bash
vim ~/.env
```

**Step 2: Add the following configuration**

```bash
# Base URL for Gemini requests routed through AI Gateway
GOOGLE_GEMINI_BASE_URL=https://gateway.theturbo.ai

# Your AI Gateway / AI Gateway API key
GEMINI_API_KEY=YOUR_API_KEY

# Default Gemini model
GEMINI_MODEL=gemini-2.5-flash
```

Replace `YOUR_API_KEY` with the API key generated after creating an AI Gateway instance.

## Use Gemini CLI

Once configured, start Gemini CLI by running:

```bash
gemini
```

Gemini CLI will now send all requests through AI Gateway, allowing centralized access to Gemini models with unified authentication and management.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">Make sure the environment variables are loaded in your shell session.</mark>
* <mark style="color:blue;">You can change the default model by updating the</mark> <mark style="color:blue;">`GEMINI_MODEL`</mark> <mark style="color:blue;">value.</mark>
* <mark style="color:blue;">Keep your API key secure and avoid committing it to source control.</mark>
  {% endhint %}
