# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/ai-gateway/ai-gateway-integration/gemini-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
