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-).
Setting Value
OPENAI_BASE_URL https://api.calgine.com.cn/v1
OPENAI_API_KEY The API token you created in the console

Installation & Configuration

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

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

        echo 'export OPENAI_API_KEY="sk-your-token"' >> ~/.zshrc
        echo 'export OPENAI_BASE_URL="https://api.calgine.com.cn/v1"' >> ~/.zshrc
        source ~/.zshrc
        
  3. Start interactive mode:

    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:

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

Key Features

Feature Description
Interactive chat Type questions directly in the terminal and get real-time answers
Pipe input Pipe code or logs into Gemini CLI for analysis
File reading Read local file contents as context
Scenario Recommended Model
General programming gpt-4o
Complex logic claude-opus-4-5-20251101
Quick questions gpt-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