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
- Sign up at the Calgine Tokens Console.
- 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
Install Gemini CLI: Make sure Node.js 20+ is installed, then run:
bashnpm install -g @google/gemini-cliSet environment variables (choose one):
bashecho 'export OPENAI_API_KEY="sk-your-token"' >> ~/.zshrc echo 'export OPENAI_BASE_URL="https://api.calgine.com.cn/v1"' >> ~/.zshrc source ~/.zshrcbashecho 'export OPENAI_API_KEY="sk-your-token"' >> ~/.bashrc echo 'export OPENAI_BASE_URL="https://api.calgine.com.cn/v1"' >> ~/.bashrc source ~/.bashrcpowershell[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-token", "User") [Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://api.calgine.com.cn/v1", "User")Start interactive mode:
bashgemini --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
| 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 |
Recommended Models
| 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