Aider
Aider is the AI pair programmer that lives in your terminal and edits code directly inside your real git repository. It's the tool that developers who love the command line reach for when they want AI to actually change their codebase — not just suggest code in a chat window — while keeping a clean, human-readable git history.
Overview
Created in 2023 by Paul Gauthier, Aider has become the gold standard for CLI-based AI coding. What makes it uniquely powerful is its deep integration with git: every change Aider makes is automatically committed with a descriptive message, giving you a clear history of what the AI did and an easy path to undo any change.
Aider is model-agnostic and works with virtually any frontier model — Claude, GPT-4.1, Gemini, DeepSeek, Mistral, and local models via Ollama. It consistently tops the aider.chat/leaderboard — one of the most respected AI coding benchmarks (SWE-bench), independently measuring how well different models + Aider solve real GitHub issues.
Key Features
- Git-Native Commits: Every file edit is automatically committed to git with an AI-generated commit message. Edit history is transparent and fully reversible with
git revert. - Architect Mode: Aider first plans a multi-step solution using a strong reasoning model, then executes the plan using a fast, cost-efficient model — combining quality and speed.
- Multi-Model Orchestration: Configure different models for different roles (e.g., Claude for planning, DeepSeek for writing) to optimize for both quality and API cost.
- Repository Map: Uses tree-sitter to build a syntax-aware map of your codebase, letting Aider understand cross-file dependencies and make coordinated changes.
- In-Chat File Control: Explicitly tell Aider which files to work with (
/add src/api.py) or let it suggest relevant files automatically. - Voice Coding: Optional speech-to-text mode for hands-free prompting.
- Universal Model Support: Works with 100+ models via API or locally via Ollama/LM Studio.
How It Works
- Launch: Run
aiderin your project directory — Aider indexes your codebase. - Request: Describe your change in natural language ("Add pagination to the users endpoint").
- Plan (Architect Mode): Aider creates a step-by-step implementation plan.
- Edit: Aider writes the code changes directly to your files.
- Commit: Changes are committed to git with a descriptive message.
- Review: Use
git diff HEAD~1to review exactly what changed.
Technical Architecture:
- Language: Python.
- Codebase Indexing: tree-sitter (multi-language syntax parsing).
- Git Integration: Native git library for atomic commits.
- Model Integration: LiteLLM for unified access to 100+ model providers.
- Context Management: Intelligent file map to stay within model context limits.
Use Cases
Feature Development
- New Endpoints: "Add a
/healthendpoint to the Express server that returns system status." - UI Components: "Create a reusable
DataTablecomponent in React with sorting and pagination." - Database Migrations: "Add an
archivedboolean field to the User model and create the migration."
Debugging & Refactoring
- Bug Fixing: Paste a stack trace and ask Aider to find and fix the root cause.
- Legacy Modernization: "Refactor this class to use async/await instead of callbacks throughout."
- Test Coverage: "Write pytest unit tests for all functions in
utils/parser.py."
Multi-File Coordination
- API + Tests + Docs: "Add the
POST /ordersendpoint with full validation, unit tests, and update the OpenAPI spec." - Cross-Module Refactoring: Rename a function across all files that import it.
Getting Started
Step 1: Install Aider
pip install aider-chat
# Or with pipx for isolated install:
pipx install aider-chat
Step 2: Set Up Your API Key
# For Claude (recommended for best results):
export ANTHROPIC_API_KEY=your-key-here
# For OpenAI:
export OPENAI_API_KEY=your-key-here
# For DeepSeek (cheapest):
export DEEPSEEK_API_KEY=your-key-here
Step 3: Start Aider in Your Project
cd your-project
aider # Uses the best available model from your env vars
# Or specify a model explicitly:
aider --model claude-sonnet-4-5
aider --model gpt-4.1
aider --model deepseek/deepseek-chat # Very cost-effective
Step 4: Use Architect Mode (Recommended)
# Plan with a strong model, execute with a cheaper one:
aider --architect --model anthropic/claude-opus-4-5 --editor-model deepseek/deepseek-chat
Step 5: Add Files and Make Changes
# Inside aider session:
> /add src/api/users.py src/models/user.py
> Add rate limiting to the POST /users endpoint — max 10 requests per minute per IP.
Best Practices
- Use Architect Mode for complex, multi-file changes.
- Add only the relevant files to keep context small and responses precise.
- Review every commit with
git diff HEAD~1before proceeding. - Use DeepSeek as the editor model in Architect Mode for 10x cost savings.
- Use
/undoif Aider's change isn't right — it reverts the last commit instantly.
Pricing & Access
- Aider Tool: Free and open-source (Apache 2.0). No subscription needed.
- API Costs (Bring Your Own Key): You pay your model provider directly.
- Cheapest option: DeepSeek V3 (~$0.001 per 1K tokens output).
- Best quality: Claude Sonnet or GPT-4.1 (~$0.01-0.03 per 1K tokens output).
- Local Option: Use Ollama with
--model ollama/deepseek-coder-v2for zero API cost.
Limitations
- CLI Only: Terminal-based — no GUI. Less accessible for non-technical users.
- API Cost: You bear the full cost of API calls. Complex tasks can become expensive with premium models.
- Context Limits: Very large codebases require careful file selection to stay within model context windows.
- No Visual Interface: Can't see live UI previews or browser output (use Cline for that).
Community & Support
- Documentation: aider.chat/docs
- GitHub: github.com/paul-gauthier/aider (20K+ stars)
- Discord: Active community server for troubleshooting and model recommendations.
- Leaderboard: aider.chat/docs/leaderboards — benchmark results for all major models.