Aider: The AI Pair Programmer That Lives in Your Terminal
Forget browser-based AI editors. Aider brings AI pair programming directly into your terminal and integrates seamlessly with your existing editor, codebase, and Git workflow. Itβs the power userβs choice for AI-assisted development in 2026.
Photo by Ilya Pavlov on Unsplash
What Is Aider?
Aider is an open-source CLI tool that lets you chat with a large language model to edit code in your local repository. Unlike Cursor or Windsurf, Aider doesnβt replace your editor β it works alongside it, making changes to your actual files that you can review in your IDE.
Why developers love it:
- Works with any LLM: GPT-4o, Claude 3.7, DeepSeek R2, local Ollama models
- Git-native: Every change is automatically committed with descriptive messages
- Full codebase awareness: Maps your entire repo structure for context
- Any editor: VSCode, Vim, Emacs, JetBrains β Aider doesnβt care
- 100% local files: No cloud sync, no proprietary formats
Installation & Setup
Install via pip
pip install aider-chat
Configure your LLM
# Use Claude 3.7 (recommended)
export ANTHROPIC_API_KEY=your_key
aider --model claude-3-7-sonnet-20250219
# Use GPT-4o
export OPENAI_API_KEY=your_key
aider --model gpt-4o
# Use DeepSeek R2 (cheapest option)
export DEEPSEEK_API_KEY=your_key
aider --model deepseek/deepseek-reasoner
# Use local Ollama model (free, private)
aider --model ollama/codellama:34b
Start a session
cd your-project/
aider app.py utils.py # add specific files
# or
aider --map-tokens 4096 # map entire repo
Core Features
ποΈ Repository Map
Aider builds a tree-sitter based map of your entire codebase β classes, functions, imports, and relationships. This means it understands your project structure without you having to manually add every file to context.
Repo-map: 312 tokens for 47 files
π Git Auto-Commit
Every change Aider makes is automatically committed:
aider: Add input validation to user registration endpoint
You can review diffs, amend messages, or undo instantly with:
/undo # undo last AI change
π§ͺ Automated Testing Loop
Aider can run your test suite after each change and iterate until tests pass:
aider --test-cmd "pytest tests/" --auto-test
This creates a tight feedback loop: write a failing test β Aider writes code β tests pass β commit.
π Web Context
/web https://docs.fastapi.tiangolo.com/tutorial/body/
Aider fetches and incorporates documentation directly into context.
Aider vs. Cursor vs. Windsurf
| Feature | Aider | Cursor | Windsurf |
|---|---|---|---|
| Editor | Any | Built-in (VSCode fork) | Built-in (VSCode fork) |
| LLM flexibility | β Any LLM | Limited | Limited |
| Git integration | β Auto-commit | Manual | Manual |
| Price | Free + API costs | $20/mo | $15/mo |
| Local/offline | β Ollama | β | β |
| Codebase awareness | β Repo map | β Codebase indexing | β |
| GUI | β Terminal only | β Full IDE | β Full IDE |
Aider wins when: You want maximum LLM flexibility, Git-native workflow, and zero subscription fees. Cursor/Windsurf win when: You want a polished IDE experience with autocomplete.
Practical Workflows
Workflow 1: Feature Development
# Start Aider on relevant files
aider src/api/users.py src/models/user.py tests/test_users.py
# Describe what you want
> Add email verification to the user registration flow.
> Send a verification email on signup and block login until verified.
# Aider edits files, commits, runs tests
Workflow 2: Bug Fix with Stack Trace
aider app.py
> I'm getting this error:
> TypeError: 'NoneType' object is not subscriptable at line 47 in get_user_profile
> The stack trace is: [paste trace]
> Fix it.
Workflow 3: Refactoring
aider --map-tokens 8192 # give full repo context
> Refactor all database calls in the services layer to use
> the repository pattern. Create a new repositories/ directory.
Workflow 4: Test Generation
aider src/payment.py tests/test_payment.py
> Write comprehensive pytest tests for the payment.py module.
> Include edge cases for failed payments, refunds, and currency conversion.
Advanced Configuration
.aider.conf.yml (project-level config)
model: claude-3-7-sonnet-20250219
map-tokens: 4096
auto-commits: true
test-cmd: pytest
dirty-commits: false
.aiderignore (like .gitignore)
node_modules/
*.lock
dist/
.env
Multi-model setup
# Use different models for different tasks
aider --model claude-3-7-sonnet-20250219 \
--weak-model claude-3-5-haiku-20241022
The βweak modelβ handles simpler tasks (commit messages, summaries) β saving costs.
Tips & Best Practices
1. Be specific about scope
# Vague (bad):
> Fix the authentication
# Specific (good):
> Fix the JWT token expiry check in auth/middleware.py β
> it's not returning 401 when the token is expired, just silently failing
2. Use /add and /drop to manage context
/add src/new_feature.py # add file to context
/drop src/old_legacy.py # remove irrelevant file
/files # see what's in context
3. Leverage /ask for exploration without edits
/ask What are all the places where user authentication is checked?
4. /run for shell commands
/run pytest tests/test_auth.py -v
Cost Estimation
With Claude 3.7 Sonnet (~$3/M tokens):
- Simple bug fix: ~$0.01β0.05
- New feature (medium): ~$0.10β0.50
- Large refactor: ~$1β5
With DeepSeek R2 (~$0.14/M tokens):
- Same tasks at ~20Γ lower cost
Verdict
Aider is the best AI coding tool for developers who want control, flexibility, and Git integration without being locked into a specific editor or AI provider. The learning curve is steeper than Cursor, but the payoff is a workflow that fits perfectly into any existing development setup.
Rating: 9/10 β Essential for terminal-native developers.
Quick Start Checklist
pip install aider-chat- Set your LLM API key
- Run
aiderin your project directory - Try
aider --model ollama/llama3for free local coding - Create
.aider.conf.ymlfor project-level defaults
Tags: #Aider #AIcoding #terminaltools #pairprogramming #opensource