# Gemini CLI Integration Guide

> **Last verified**: 2026-09-18 · 📄 Per official docs (Gemini CLI v0.60.0 (2026-09-15; Pro/free tiers stopped being served 2026-06-18, enterprise paid keys continue))

## At a glance

| Item | Details |
|---|---|
| Models you can use | Gemini ✅ · Claude ❌ · GPT ❌ · Chinese models ❌ |
| Protocol & Base URL | Gemini: `https://api.qcode.cc/gemini` (the CLI appends `/v1beta/...` itself — do not add it by hand) |
| Where to configure | `~/.gemini/settings.json` or env `GOOGLE_GEMINI_BASE_URL` + `GEMINI_API_KEY` |
| Official docs | [google-gemini/gemini-cli](https://github.com/google-gemini/gemini-cli) |

> **⚠️ Important change: the consumer sign-in path was replaced by Google Antigravity CLI**. The official post of 2026-05-19 states, verbatim, that from **2026-06-18** Gemini CLI and the Gemini Code Assist IDE extensions "will stop serving requests" — for **Google AI Pro and Ultra**, and for people using it free of charge with a personal account. What became available that day was **Antigravity CLI and Antigravity 2.0** (the Antigravity IDE itself shipped earlier, on 2025-11-18). Enterprise is a different case: organizations on a Gemini Code Assist Standard or Enterprise licence keep access, and the same post says "Gemini CLI will remain accessible via paid Gemini and Gemini Enterprise Agent Platform API keys". **So this page still applies to enterprise paid keys**; Pro / Ultra / free users should move to [Google Antigravity CLI](/docs/ide/antigravity).
>
> The repository is not unmaintained: on the day of this check (2026-09-18) it still published a nightly build, and the latest stable release is v0.60.0 (2026-09-15). The accurate wording is "**stopped serving consumer sign-ins**", not "stopped being maintained".

> **🚧 Limited Availability**: Gemini resources are currently available on a limited basis and not yet widely offered. If you have significant usage needs, please contact our [live chat](javascript:void(Tawk_API.toggle())) or email **hi@qcode.cc** — we can arrange dedicated Gemini resources for you.

QCode.cc supports Claude Code, OpenAI Codex, and Google Gemini CLI. After purchasing a plan, all three tools **share the same quota**, giving you flexibility to choose which tool to use.

## What is Gemini CLI

[Gemini CLI](https://geminicli.com/) is Google's command-line AI programming assistant, similar to Claude Code, that helps you with code development, debugging, and file operations in the terminal.

## Available Models

The following Gemini models are available through QCode.cc:

**Treat the live query as authoritative** — do not copy a fixed list from any document,
including this one:

```bash
curl -s https://api.qcode.cc/gemini/v1beta/models \
  -H "x-goog-api-key: cr_your_qcode_key"
```

Whatever ids come back are the Gemini models you can call; put one in `GEMINI_MODEL`.
The full catalogue and live prices are on [qcode.cc/models](https://qcode.cc/models).

> **Version note**: since 2026-06-18 Gemini CLI no longer serves Pro / Ultra / free personal accounts — switch to [Google Antigravity CLI](https://antigravity.google/) (Antigravity CLI and Antigravity 2.0 became available 2026-05-19); enterprise paid keys are unaffected and can keep using Gemini CLI.

## Configuration Overview

Gemini CLI requires the following environment variables:

- `GOOGLE_GEMINI_BASE_URL` - Service endpoint

- `GEMINI_API_KEY` - API key (same as Claude Code)

- `GEMINI_MODEL` - Model selection
The settings file is the other officially supported path: user-level `~/.gemini/settings.json`, project-level `.gemini/settings.json` (project overrides user). The model is `model.name`, the auth type is `security.auth.selectedType`; string values in those files may reference environment variables with `$VAR`, `${VAR}` or `${VAR:-default}`. The docs state that `GOOGLE_GEMINI_BASE_URL` applies to gemini-api-key authentication, so set both variables as shown below.


<div data-os="macos" markdown="1">

## macOS Configuration

### Step 1: Install Node.js

Gemini CLI requires Node.js to run.

#### Method 1: Using Homebrew (Recommended)

If you have Homebrew installed, use it to install Node.js:

```bash
# Update Homebrew
brew update

# Install Node.js
brew install node
```

#### Method 2: Official Download

1. Visit [https://nodejs.org/](https://nodejs.org/)

2. Download the LTS version for macOS

3. Open the downloaded `.pkg` file

4. Follow the installer instructions to complete installation

#### macOS Notes

- You may need to use `sudo` if you encounter permission issues

- First run may require approval in System Preferences

- Terminal or iTerm2 is recommended

#### Verify Node.js Installation

After installation, open Terminal and run:

```bash
node --version
npm --version
```

If version numbers are displayed, installation was successful!

### Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

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

After installation, verify:

```bash
gemini --version
```

### Step 3: Configure Gemini CLI Environment Variables

Set the following environment variables to connect to the proxy service:

#### Temporary Setup (Current Session)

Run the following commands in terminal:

```bash
export GOOGLE_GEMINI_BASE_URL="https://api.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
```

> Replace `cr_xxxxxxxxxx` with your [QCode.cc API key](https://qcode.cc/dashboard). Use the same API key as Claude Code.

#### Permanent Setup (Shell Configuration)

Add the following to your shell configuration file (`~/.zshrc`):

```bash
# Gemini CLI Configuration
export GOOGLE_GEMINI_BASE_URL="https://api.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
```

Then run:

```bash
source ~/.zshrc
```

### Verify Gemini CLI Environment Variables

Verify in terminal:

```bash
echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL
```

</div>

<div data-os="linux" markdown="1">

## Linux / WSL2 Configuration

### Step 1: Install Node.js

Gemini CLI requires Node.js to run.

#### Method 1: Using nvm (Recommended)

nvm makes it easy to manage multiple Node.js versions:

```bash
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Reload shell configuration
source ~/.bashrc

# Install latest LTS version
nvm install --lts
```

#### Method 2: Using Package Manager

```bash
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# Fedora
sudo dnf install nodejs

# Arch Linux
sudo pacman -S nodejs npm
```

#### Linux / WSL2 Notes

- WSL2 users should install in Linux subsystem, not Windows

- Using nvm helps avoid permission issues

- Ensure shell configuration file properly loads nvm

#### Verify Node.js Installation

After installation, open terminal and run:

```bash
node --version
npm --version
```

If version numbers are displayed, installation was successful!

### Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

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

After installation, verify:

```bash
gemini --version
```

### Step 3: Configure Gemini CLI Environment Variables

Set the following environment variables to connect to the proxy service:

#### Temporary Setup (Current Session)

Run the following commands in terminal:

```bash
export GOOGLE_GEMINI_BASE_URL="https://api.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
```

> Replace `cr_xxxxxxxxxx` with your [QCode.cc API key](https://qcode.cc/dashboard). Use the same API key as Claude Code.

#### Permanent Setup (Shell Configuration)

Add the following to your shell configuration file (`~/.bashrc`):

```bash
# Gemini CLI Configuration
export GOOGLE_GEMINI_BASE_URL="https://api.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
```

Then run:

```bash
source ~/.bashrc
```

If using Zsh, add to `~/.zshrc` and run `source ~/.zshrc`.

### Verify Gemini CLI Environment Variables

Verify in terminal:

```bash
echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL
```

</div>

<div data-os="windows" markdown="1">

## Windows Configuration

### Step 1: Install Node.js

Gemini CLI requires Node.js to run.

#### Method 1: Official Download (Recommended)

1. Open your browser and visit [https://nodejs.org/](https://nodejs.org/)

2. Click the "LTS" version to download (recommended for stability)

3. Double-click the downloaded `.msi` file

4. Follow the installation wizard, keeping default settings

#### Method 2: Using Package Manager

If you have Chocolatey or Scoop installed, use command line:

```powershell
# Using Chocolatey
choco install nodejs

# Or using Scoop
scoop install nodejs
```

#### Windows Notes

- PowerShell is recommended over CMD

- Run as Administrator if you encounter permission issues

- Some antivirus software may flag it; add to whitelist if needed

#### Verify Node.js Installation

After installation, open PowerShell or CMD and run:

```powershell
node --version
npm --version
```

If version numbers are displayed, installation was successful!

### Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

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

After installation, verify:

```powershell
gemini --version
```

### Step 3: Configure Gemini CLI Environment Variables

Set the following environment variables to connect to the proxy service:

#### PowerShell Temporary Setup (Current Session)

Run the following commands in PowerShell:

```powershell
$env:GOOGLE_GEMINI_BASE_URL = "https://api.qcode.cc/gemini"
$env:GEMINI_API_KEY = "cr_xxxxxxxxxx"
$env:GEMINI_MODEL = "gemini-2.5-pro"
```

> Replace `cr_xxxxxxxxxx` with your [QCode.cc API key](https://qcode.cc/dashboard). Use the same API key as Claude Code.

#### PowerShell Permanent Setup (User Level)

Run the following commands in PowerShell:

```powershell
# Set user-level environment variables (permanent)
[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://api.qcode.cc/gemini", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "cr_xxxxxxxxxx", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("GEMINI_MODEL", "gemini-2.5-pro", [System.EnvironmentVariableTarget]::User)
```

> You need to reopen PowerShell for changes to take effect.

### Verify Gemini CLI Environment Variables

Verify in PowerShell:

```powershell
echo $env:GOOGLE_GEMINI_BASE_URL
echo $env:GEMINI_API_KEY
echo $env:GEMINI_MODEL
```

</div>

## Troubleshooting

### Node.js Version Too Old

**Problem**: Gemini CLI reports Node.js version incompatibility

**Solution**:

1. Check Node.js version: `node --version`

2. The official requirement is Node.js **20.0.0 or higher** (`engines.node >=20.0.0`); staying on 18 fails right after install

3. Upgrade using nvm: `nvm install --lts && nvm use --lts`

### Environment Variables Not Taking Effect

**Problem**: Cannot connect after setting environment variables

**Solution**:

1. Ensure you reopened terminal or ran `source` command

2. Check variable names are correct (case-sensitive)

3. Verify API key format is correct (starts with `cr_`)

### Network Connection Issues

**Problem**: Cannot connect to QCode.cc service

**Solution**:

1. Check network connection

2. Verify `GOOGLE_GEMINI_BASE_URL` is correctly set

3. Try backup endpoints:
   - Asia backup: `https://asia.qcode.cc/gemini`

## Related Documentation

- [Antigravity CLI](/docs/ide/antigravity) - the official successor to Gemini CLI
- [Environment Configuration](/docs/getting-started/environment) - Claude Code setup

- [Codex Integration](/docs/ide/codex) - OpenAI Codex CLI configuration

- [Quick Start](/docs/getting-started/quick-start) - Getting started with Claude Code