Aider Integration

Use the Aider open-source AI coding assistant with QCode.cc API

Aider Integration

Aider is a popular open-source AI coding assistant (39K+ GitHub Stars) that runs in the terminal and supports 100+ programming languages. It can be configured to work with QCode.cc API using just a couple of environment variables.

Why Aider?

  • Fully open source and free: You only pay for API usage

  • Architect mode: Use one model for planning and another for execution, improving code quality

  • Deep Git integration: Automatically creates git commits for each AI edit

  • Repository Map: Intelligent codebase indexing powered by tree-sitter

  • Simplest setup: Just two environment variables to connect to QCode.cc

Installation

# Recommended: use pipx (isolated installation)
pipx install aider-chat

# Or use pip
pip install aider-chat

Configuring QCode.cc

export OPENAI_API_BASE="https://asia.qcode.cc/claude/v1"
export OPENAI_API_KEY="cr_your_api_key"

To make it permanent (add to ~/.zshrc or ~/.bashrc):

echo 'export OPENAI_API_BASE="https://asia.qcode.cc/claude/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="cr_your_api_key"' >> ~/.zshrc
source ~/.zshrc

Method 2: Command-Line Arguments

aider --openai-api-base "https://asia.qcode.cc/claude/v1" \
      --openai-api-key "cr_your_api_key" \
      --model openai/claude-sonnet-4-6

Usage

Basic Usage

# Navigate to your project directory
cd /path/to/your/project

# Start Aider with Claude Sonnet
aider --model openai/claude-sonnet-4-6

# Use Claude Opus (more powerful)
aider --model openai/claude-opus-4-6

Architect mode lets one model handle planning while another handles code changes:

# Opus for planning + Sonnet for execution (recommended)
aider --architect --model openai/claude-opus-4-6 --editor-model openai/claude-sonnet-4-6

# Sonnet for planning + Haiku for execution (cost-effective)
aider --architect --model openai/claude-sonnet-4-6 --editor-model openai/claude-haiku-4-5-20251001

Common Commands

During an Aider session:

Command Description
/add file.py Add a file to the chat context
/drop file.py Remove a file
/run pytest Run a command and send the output to the AI
/diff Show all changes
/undo Undo the last AI edit
/commit Commit current changes
/help Show help

Alternative Endpoints

# Hong Kong endpoint
export OPENAI_API_BASE="http://103.218.243.5/claude/v1"

# Shenzhen endpoint
export OPENAI_API_BASE="http://103.236.53.153/claude/v1"

Available Models

Model Name in Aider Notes
Claude Sonnet 4.6 openai/claude-sonnet-4-6 Recommended, great value
Claude Opus 4.6 openai/claude-opus-4-6 Most powerful model
Claude Haiku 4.5 openai/claude-haiku-4-5-20251001 Low cost, fast

Note: Model names must be prefixed with openai/ to tell Aider to use the OpenAI-compatible endpoint.

Comparison with Claude Code CLI

Aspect Aider Claude Code CLI
Open source Fully open source Not open source
Git integration Auto-commit on each edit Manual /commit
Architect mode Dual-model planning + execution Single model
Tool capabilities File editing + Shell Richer (LSP, search, browser)
Context management Repository Map smart indexing 200K–1M token window
Quota Shared QCode.cc plan quota Shared QCode.cc plan quota

Recommended combination: Use Aider for quick code modifications and Architect mode planning; use Claude Code CLI for complex project analysis and automation tasks.

FAQ

Getting "Model not found" error?

Make sure the model name has the openai/ prefix:

# Correct
aider --model openai/claude-sonnet-4-6

# Wrong (missing prefix)
aider --model claude-sonnet-4-6

API call timeout?

Try switching to an alternative endpoint, or increase the timeout:

aider --model openai/claude-sonnet-4-6 --timeout 120

Next Steps

πŸš€
Get Started with QCode β€” AI Coding Assistant
Official Claude Code relay, fast and reliable, ready to use
View Pricing Plans β†’ Create Account