Gemini Integration
Configure Google Gemini CLI with QCode.cc API key
Gemini CLI Integration Guide¶
🚧 Beta Notice: Gemini resources are currently in limited beta testing. Once stable and fully tested, they will be officially released. Stay tuned!
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.
Configuration Overview¶
Gemini CLI requires the following environment variables:
GOOGLE_GEMINI_BASE_URL- Service endpointGEMINI_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.
Method 1: Using Homebrew (Recommended)¶
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¶
- Visit https://nodejs.org/
- Download the LTS version for macOS
- Open the downloaded
.pkgfile - Follow the installer instructions to complete installation
macOS Notes¶
- You may need to use
sudoif 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://asia.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
Replace
cr_xxxxxxxxxxwith 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://asia.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.
Method 1: Using nvm (Recommended)¶
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://asia.qcode.cc/gemini"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-2.5-pro"
Replace
cr_xxxxxxxxxxwith 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://asia.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.
Method 1: Official Download (Recommended)¶
- Open your browser and visit https://nodejs.org/
- Click the "LTS" version to download (recommended for stability)
- Double-click the downloaded
.msifile - 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://asia.qcode.cc/gemini"
$env:GEMINI_API_KEY = "cr_xxxxxxxxxx"
$env:GEMINI_MODEL = "gemini-2.5-pro"
Replace
cr_xxxxxxxxxxwith 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://asia.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:
- Check Node.js version:
node --version - Node.js 18.x or higher is recommended
- Upgrade using nvm:
nvm install --lts && nvm use --lts
Environment Variables Not Taking Effect¶
Problem: Cannot connect after setting environment variables
Solution:
- Ensure you reopened terminal or ran
sourcecommand - Check variable names are correct (case-sensitive)
- Verify API key format is correct (starts with
cr_)
Network Connection Issues¶
Problem: Cannot connect to QCode.cc service
Solution:
- Check network connection
- Verify
GOOGLE_GEMINI_BASE_URLis correctly set - Try backup endpoints:
- Hong Kong:
http://103.218.243.5/gemini - Shenzhen:
http://103.236.53.153/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 Documentation¶
- Environment Configuration - Claude Code setup
- Codex Integration - OpenAI Codex CLI configuration
- Quick Start - Getting started with Claude Code