Gemini Integration

Configure Google Gemini CLI with QCode.cc API key

Gemini CLI Integration Guide

⚠️ Important change: Gemini CLI is being retired in favor of Google Antigravity CLI. Google Antigravity became available on 2026-05-19, and Gemini CLI reached end-of-life (EOL) for Pro / free users on 2026-06-18; enterprise paid keys are unaffected. The Gemini CLI setup on this page remains valid for enterprise users and until EOL — going forward, please use Google Antigravity CLI.

🚧 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 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 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:

Model Description
gemini-3.5-flash Latest fast model, recommended
gemini-2.5-pro Stable version
gemini-2.5-flash Fast version

Version note: Gemini CLI reached EOL for Pro / free users on 2026-06-18 — please switch to Google Antigravity CLI (available 2026-05-19); enterprise paid keys can continue using Gemini CLI after EOL.

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

macOS Configuration

Step 1: Install Node.js

Gemini CLI requires Node.js to run.

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

# Update Homebrew
brew update

# Install Node.js
brew install node
Method 2: Official Download
  1. Visit 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:

node --version
npm --version

If version numbers are displayed, installation was successful!

Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

After installation, verify:

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:

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. Use the same API key as Claude Code.

Permanent Setup (Shell Configuration)

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

# 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:

source ~/.zshrc

Verify Gemini CLI Environment Variables

Verify in terminal:

echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL

Linux / WSL2 Configuration

Step 1: Install Node.js

Gemini CLI requires Node.js to run.

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

# 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
# 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:

node --version
npm --version

If version numbers are displayed, installation was successful!

Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

After installation, verify:

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:

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. Use the same API key as Claude Code.

Permanent Setup (Shell Configuration)

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

# 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:

source ~/.bashrc

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

Verify Gemini CLI Environment Variables

Verify in terminal:

echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL

Windows Configuration

Step 1: Install Node.js

Gemini CLI requires Node.js to run.

  1. Open your browser and visit 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:

# 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:

node --version
npm --version

If version numbers are displayed, installation was successful!

Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

After installation, verify:

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:

$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. Use the same API key as Claude Code.

PowerShell Permanent Setup (User Level)

Run the following commands in 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:

echo $env:GOOGLE_GEMINI_BASE_URL
echo $env:GEMINI_API_KEY
echo $env:GEMINI_MODEL

Troubleshooting

Node.js Version Too Old

Problem: Gemini CLI reports Node.js version incompatibility

Solution:

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

  2. Node.js 18.x or higher is recommended

  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:

  4. Asia backup: https://asia.qcode.cc/gemini

QCode.cc Advantages

Advantage Description
80% Cost Savings Significantly lower than official pricing
Shared Quota Claude Code, Codex, and Gemini share the same plan quota
99.9% Availability Enterprise-grade stable service
Asia-Pacific Optimized Low latency, fast response

Related Documents

Codex Complete Tutorial
From Installation to Mastery — Complete Usage Guide for OpenAI Codex CLI with QCode.cc
Connect SillyTavern to QCode
Chat with QCode.cc's Claude / GPT models in SillyTavern; an honest note on whether gpt-image-2 image generation can be connected, plus alternatives
Cursor Editor Setup
Connect QCode.cc to Cursor IDE with a custom Anthropic / OpenAI Base URL + API Key, including model config, custom-endpoint limitations, and troubleshooting
🚀
Get Started with QCode — Claude Code & Codex
One plan for both Claude Code and Codex, Asia-Pacific low latency
View Pricing Plans → Create Account
Team of 3+?
Enterprise: dedicated domain + sub-key management + ban protection, from ¥250/person/mo
Learn Enterprise →