Integrating Aider

AI pair programming in your terminal — automatically writes code, runs tests, and creates Git commits. It connects to Calgine Tokens via the OpenAI-compatible API.

Aider is a terminal-based AI pair programming tool that edits your local codebase directly and automatically generates Git commits.

Prerequisites

  1. Sign up at the Calgine Tokens Console.
  2. Go to Workspace → API Tokens, click "Add Token", and copy the API Key after creation (starts with sk-).
Setting Value
OPENAI_API_BASE https://api.calgine.com.cn/v1
OPENAI_API_KEY The API token you created in the console

Installation

pip install aider-chat

Or use pipx (recommended, avoids dependency conflicts):

pipx install aider-chat

Configuration & Launch

echo 'export OPENAI_API_KEY="sk-your-token"' >> ~/.zshrc
echo 'export OPENAI_API_BASE="https://api.calgine.com.cn/v1"' >> ~/.zshrc
source ~/.zshrc

After setting the environment variables, enter your project directory and launch:

cd your-project
aider --model gpt-4o

Option 2: Command-Line Arguments (One-Off)

aider \
  --openai-api-key sk-your-token \
  --openai-api-base https://api.calgine.com.cn/v1 \
  --model gpt-4o

Using Anthropic Models

# Set environment variables
export ANTHROPIC_API_KEY="sk-your-token"
export ANTHROPIC_BASE_URL="https://api.calgine.com.cn/anthropic"

# Launch
aider --model claude-opus-4-5-20251101

Using a .aider.conf.yml Config File

Create .aider.conf.yml in your project root to avoid passing arguments every time:

openai-api-key: sk-your-token
openai-api-base: https://api.calgine.com.cn/v1
model: gpt-4o

Verify the Setup

After launching Aider, type a simple instruction (e.g., "add a hello world function"). If Aider edits files and creates a commit normally, the setup is complete.

Common Commands

Command Description
/add <file> Add a file to the current editing context
/drop <file> Remove a file from the context
/diff Show all code changes made in this session
/undo Undo the most recent AI-made Git commit
/commit Commit the current changes
/model <name> Switch the model
/exit Exit Aider
Scenario Recommended Model
General coding gpt-4o
Complex refactoring claude-opus-4-5-20251101
Rapid iteration gpt-4o-mini

Next Steps

  • Claude Code: Another terminal-based AI coding tool
  • Rate Limits: Learn about the platform's call frequency limits