Skip to content

Gemini CLI Integration ​

Google's official command-line AI tool that interacts with models directly in your terminal, connecting to Calgine Tokens via OpenAI-compatible mode.

Gemini CLI is an open-source command-line AI assistant from Google, supporting conversational Q&A, code analysis, file reading, and more. By setting the OpenAI-compatible environment variables, you can seamlessly switch it to all models on the Calgine Tokens platform.

Prerequisites ​

  1. Sign up at the Calgine Tokens Console.
  2. Go to Workspace → API Tokens, click "Add Token", and copy the API Key once created (starts with sk-).
SettingValue
OPENAI_BASE_URLhttps://api.calgine.com.cn/v1
OPENAI_API_KEYThe API token you created in the console

Installation & Configuration ​

  1. Install Gemini CLI: Make sure Node.js 20+ is installed, then run:

    bash
    npm install -g @google/gemini-cli
  2. Set environment variables (choose one):

    bash
    echo 'export OPENAI_API_KEY="sk-your-token"' >> ~/.zshrc
    echo 'export OPENAI_BASE_URL="https://api.calgine.com.cn/v1"' >> ~/.zshrc
    source ~/.zshrc
    bash
    echo 'export OPENAI_API_KEY="sk-your-token"' >> ~/.bashrc
    echo 'export OPENAI_BASE_URL="https://api.calgine.com.cn/v1"' >> ~/.bashrc
    source ~/.bashrc
    powershell
    [Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-token", "User")
    [Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://api.calgine.com.cn/v1", "User")
  3. Start interactive mode:

    bash
    gemini --model gpt-4o

Verify the Setup ​

Once started, type any question in the terminal. A normal response means the integration is working. You can also pipe in code to verify its analysis capability:

bash
cat main.py | gemini "Analyze potential issues in this code"

Key Features ​

FeatureDescription
Interactive chatType questions directly in the terminal and get real-time answers
Pipe inputPipe code or logs into Gemini CLI for analysis
File readingRead local file contents as context
ScenarioRecommended Model
General programminggpt-4o
Complex logicclaude-opus-4-5-20251101
Quick questionsgpt-4o-mini

Next Steps ​

  • OpenAI Codex CLI: A command-line agent that executes coding tasks autonomously
  • Zed Editor: A high-performance editor with a built-in AI assistant