Integrating Gemini CLI with CodingPlanX Custom Models

Configure the Google Gemini CLI using your CodingPlanX.ai API Key.

Gemini CLI Integration Guide

CodingPlanX.ai supports Claude Code, OpenAI Codex, and Google Gemini CLI. Once you purchase a plan, these three tools share the same plan quota, allowing you to flexibly choose the tool that best fits your workflow.

What is Gemini CLI?

Gemini CLI is a command-line AI programming assistant introduced by Google. Similar to Claude Code, it helps you develop code, debug, and manipulate files directly within your terminal.

Available Models

You can access the following Gemini models via CodingPlanX.ai:

ModelDescription
gemini-3-pro-previewLatest preview version (Recommended)
gemini-2.5-proStable version

Latest Version: Gemini CLI v0.33.1 (2026-03-12), featuring the Extensions system, custom themes, and more.

Configuration Overview

Gemini CLI requires the following environment variables to be set:

  • GOOGLE_GEMINI_BASE_URL - Service endpoint URL
  • GEMINI_API_KEY - API Key (Same as Claude Code)
  • GEMINI_MODEL - Selected model

macOS Configuration

Step 1: Install Node.js Environment

Gemini CLI requires Node.js to run.

Method 1: Using Homebrew (Recommended)

If you have Homebrew installed, it's the easiest way to install Node.js:

# Update Homebrew
brew update

# Install Node.js
brew install node
Method 2: Download from Official Website
  1. Visit https://nodejs.org/
  2. Download the LTS version for macOS
  3. Open the downloaded .pkg file
  4. Follow the installer instructions
macOS Notes
  • If you encounter permission issues, you might need to use sudo.
  • First-time execution may require permission in System Settings.
  • Using Terminal or iTerm2 is recommended.
Verify Node.js Installation

Once installed, open your Terminal and enter:

node --version
npm --version

If the versions are displayed, the installation was successful!

Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

Verify the installation:

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 these commands in your terminal:

export GOOGLE_GEMINI_BASE_URL="https://api.codingplanx.ai"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-3-pro-preview"

Replace cr_xxxxxxxxxx with your CodingPlanX.ai API Key. You can use the same API key as you do for Claude Code.

Permanent Setup (Shell Profile)

Add the following lines to your shell configuration file (e.g., ~/.zshrc):

# Gemini CLI Configuration
export GOOGLE_GEMINI_BASE_URL="https://api.codingplanx.ai"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-3-pro-preview"

Then apply the changes:

source ~/.zshrc

Verify Environment Variables

Test the variables in your terminal:

echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL

Linux / WSL2 Configuration

Step 1: Install Node.js Environment

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 the latest LTS version
nvm install --lts
Method 2: Using Package Managers
# 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 Node.js inside the Linux subsystem, not on Windows.
  • Using nvm helps avoid permission issues.
  • Ensure your shell profile properly loads nvm.
Verify Node.js Installation

Open your terminal and enter:

node --version
npm --version

Step 2: Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

Verify the installation:

gemini --version

Step 3: Configure Gemini CLI Environment Variables

Temporary Setup (Current Session)
export GOOGLE_GEMINI_BASE_URL="https://api.codingplanx.ai"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-3-pro-preview"

Replace cr_xxxxxxxxxx with your CodingPlanX.ai API Key.

Permanent Setup (Shell Profile)

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

# Gemini CLI Configuration
export GOOGLE_GEMINI_BASE_URL="https://api.codingplanx.ai"
export GEMINI_API_KEY="cr_xxxxxxxxxx"
export GEMINI_MODEL="gemini-3-pro-preview"

Apply the changes:

source ~/.bashrc

If you use Zsh, add it to ~/.zshrc and run source ~/.zshrc.

Verify Environment Variables

echo $GOOGLE_GEMINI_BASE_URL
echo $GEMINI_API_KEY
echo $GEMINI_MODEL

Windows Configuration

Step 1: Install Node.js Environment

Method 1: Download from Official Website (Recommended)
  1. Visit https://nodejs.org/
  2. Click on the "LTS" version to download.
  3. Run the downloaded .msi file.
  4. Follow the setup wizard, keeping the default settings.
Method 2: Using a Package Manager

If you have Chocolatey or Scoop installed:

# Using Chocolatey
choco install nodejs

# Or using Scoop
scoop install nodejs
Windows Notes
  • Using PowerShell is recommended over CMD.
  • If you face permission errors, try running as Administrator.
  • Some antivirus software might trigger false positives; whitelist if necessary.
Verify Node.js Installation

Open PowerShell or CMD and enter:

node --version
npm --version

Step 2: Install Gemini CLI

npm install -g @google/gemini-cli

Verify the installation:

gemini --version

Step 3: Configure Gemini CLI Environment Variables

PowerShell Temporary Setup (Current Session)

Run the following in PowerShell:

$env:GOOGLE_GEMINI_BASE_URL = "https://api.codingplanx.ai"
$env:GEMINI_API_KEY = "cr_xxxxxxxxxx"
$env:GEMINI_MODEL = "gemini-3-pro-preview"

Replace cr_xxxxxxxxxx with your CodingPlanX.ai API Key.

PowerShell Permanent Setup (User Level)

Run the following in PowerShell:

# Set user-level environment variables (Permanent)
[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://api.codingplanx.ai", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "cr_xxxxxxxxxx", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("GEMINI_MODEL", "gemini-3-pro-preview", [System.EnvironmentVariableTarget]::User)

You need to restart your PowerShell window for these changes to take effect.

Verify Environment Variables

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

FAQ / Troubleshooting

Node.js Version Too Low

Issue: Gemini CLI prompts that the Node.js version is incompatible.

Solution:

  1. Check your 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

Issue: Cannot connect after setting environment variables.

Solution:

  1. Ensure you have restarted your terminal or run the source command.
  2. Check if the variable names are spelled correctly (case-sensitive).
  3. Verify your API key format (starts with cr_).

Network Connection Issues

Issue: Unable to connect to CodingPlanX.ai services.

Solution:

  1. Check your internet connection.
  2. Verify that GOOGLE_GEMINI_BASE_URL is set correctly.