🚀 Connecting Aider to CodingPlanX Custom Models

> Introduction: This guide shows you how to use Aider, the popular open-source AI pair programmer, with CodingPlanX.ai API for a top-tier terminal-based AI coding experience.

Aider is a leading CLI AI coding assistant (39K+ GitHub Stars). It runs in your terminal and supports 100+ languages. By setting simple environment variables, you can connect Aider to CodingPlanX.ai.


✨ Why Aider?

  • 🆓 Fully Open Source: Pay only for the API usage via CodingPlanX.ai.
  • 🧠 Architect Mode: A dual-model system where one model plans and another writes code.
  • 🌳 Repository Map: Uses tree-sitter to understand your entire codebase structure.
  • 🔗 Git Integration: Automatically creates descriptive Git commits for every AI change.
  • Minimal Config: Connect in seconds with just two environment variables.

🛠️ Installation

1. Prerequisites

  • Python 3.8+ installed.
  • CodingPlanX.ai API Key (starts with cr_).

2. Install Aider

# Recommended: Install via pipx
pipx install aider-chat

# Alternative: Standard pip
pip install aider-chat

⚙️ Configuration

Temporary (Current terminal session):

export OPENAI_API_BASE="https://api.codingplanx.ai/v1"
export OPENAI_API_KEY="cr_your_api_key"

Permanent (Add to config file): Add these to your ~/.zshrc or ~/.bashrc:

echo 'export OPENAI_API_BASE="https://api.codingplanx.ai/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="cr_your_api_key"' >> ~/.zshrc
source ~/.zshrc

Method 2: Command Line Arguments

aider --openai-api-base "https://api.codingplanx.ai/v1" \
      --openai-api-key "cr_your_api_key" \
      --model openai/claude-sonnet-4-6

💻 Getting Started

Basic Usage

cd /path/to/your/project

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

Architect mode uses a "planner" model (like Opus) and an "editor" model (like Sonnet) to improve quality while managing costs.

# Quality Focus: Opus plans + Sonnet edits
aider --architect --model openai/claude-opus-4-6 --editor-model openai/claude-sonnet-4-6

⌨️ Common Slash Commands

CommandDescription
/add file.pyAdd a file to the AI's context
/drop file.pyRemove a file from context to save tokens
/run pytestRun tests and feed errors back to the AI for fixing
/undoRevert the last AI code change

⚖️ Aider vs. Claude Code CLI

Feature🤖 Aider💻 Claude Code CLI
Open SourceYesNo (Proprietary)
Git IntegrationAuto-commitManual commit
WorkflowMulti-model (Architect)Single-model
ContextRepo Map (AST)Massive Token Window

❓ Troubleshooting (FAQ)

Q: "Model not found" error? A: Ensure you include the openai/ prefix.

  • ✅ Correct: openai/claude-sonnet-4-6

Q: API Timeout? A: Increase the timeout limit:

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