Skip to content

Gemini CLI

This service supports the Gemini-compatible interface required by Gemini CLI.

Prerequisites

Gemini CLI is installed via npm, so you need:

  • Node.js 18+
  • npm (usually installed with Node.js)

Install Node.js from the official page: https://nodejs.org/en/download

  • macOS / Windows: download and install the LTS release
  • Linux: use the distro-specific method listed on that page

On macOS with Homebrew:

bash
brew install node

Verify your environment:

bash
node -v
npm -v

Install

bash
npm install -g @google/gemini-cli

Verify the install:

bash
gemini --version

Configure

Gemini CLI supports three environment variables for connecting to a custom gateway:

VariableDescription
GOOGLE_GEMINI_BASE_URLGateway root URL, replaces the default Google endpoint
GEMINI_API_KEYYour API key
GEMINI_MODELDefault model to use

Configuration example:

export GOOGLE_GEMINI_BASE_URL="https://codex.openai.com"
export GEMINI_API_KEY="codex_your_api_key"
export GEMINI_MODEL="gemini-2.5-pro"

Use the service root in GOOGLE_GEMINI_BASE_URL, not a full API path. Gemini CLI appends the API paths automatically.

To make this permanent, add the export statements to your shell profile (~/.zshrc or ~/.bashrc), then reload it with source ~/.zshrc.

Launch

bash
gemini

Verify

Start a conversation in Gemini CLI. If you receive a normal response, the setup is working.

If you see an auth error, check that GEMINI_API_KEY is correct and GOOGLE_GEMINI_BASE_URL points to the right service address.

OpenAI-compatible gateway integration docs