🤖 AI Tools
· 4 min read

Aider Complete Guide — The Git-Native AI Pair Programmer (2026)


Aider is a free, open-source AI pair programming tool that runs in your terminal. You chat with it in plain English, and it directly edits files in your local Git repository. Every change is automatically committed with a descriptive message.

It’s the most model-flexible AI coding tool available — it works with Claude, GPT, Gemini, DeepSeek, Qwen, local models via Ollama, or any OpenAI-compatible API.

Why Aider?

Most AI coding tools lock you into one model. Claude Code only works with Claude. Codex CLI only works with GPT. Aider works with everything.

Key strengths:

  • Git-native — every AI edit is a clean Git commit you can review, revert, or cherry-pick
  • 100+ model support — any model, any provider, including local
  • Repo map — understands your entire codebase structure, not just open files
  • Multi-file editing — coordinates changes across multiple files in one operation
  • 100+ languages — not just Python and JavaScript

Installation

pip install aider-chat

Or with pipx (recommended for isolation):

pipx install aider-chat

Quick start

cd your-project
export ANTHROPIC_API_KEY="your-key"  # or OPENAI_API_KEY, etc.
aider

Aider starts in your project directory, scans the Git repo, and builds a map of your codebase.

Choosing a model

Aider supports tiered model usage — a powerful model for complex edits and a cheaper one for simple tasks:

# Use Claude Opus for main editing, Sonnet for quick tasks
aider --model claude-3-opus-20240229 --weak-model claude-3-sonnet-20240229

# Use GPT-5.4 
aider --model gpt-5.4

# Use DeepSeek (cheapest frontier option)
aider --model deepseek/deepseek-chat

# Use a local model via Ollama
aider --model ollama/qwen3.5:27b

# Use any model via OpenRouter
export OPENROUTER_API_KEY="your-key"
aider --model openrouter/anthropic/claude-opus-4.6

See our OpenRouter guide for the full model catalog.

Core commands

Adding files to context

/add src/auth.ts src/middleware.ts
/add src/routes/*.ts          # glob patterns work
/read docs/API.md             # read-only context (not edited)
/drop src/auth.ts             # remove from context

Editing modes

Aider has multiple edit formats optimized for different models:

  • whole — replaces entire files (best for smaller files)
  • diff — sends unified diffs (best for large files)
  • udiff — universal diff format
  • editor — opens your editor for manual review
aider --edit-format diff  # Use diff mode

Git integration

/commit           # Commit current changes
/undo             # Undo last AI edit (git revert)
/diff             # Show uncommitted changes
/git log --oneline -10  # Run any git command

Every AI edit creates an automatic commit like:

aider: Refactor auth middleware to use JWT validation

Running commands

/run npm test              # Run tests
/run npm run lint          # Run linter
/test npm test             # Run tests and auto-fix failures

The /test command is powerful — it runs your test suite, and if tests fail, Aider automatically tries to fix the code and re-runs until tests pass.

Web content

/web https://docs.stripe.com/api/charges  # Fetch docs for context

Advanced features

Repo map

Aider builds a map of your entire repository — function signatures, class definitions, imports, and dependencies. This means it understands how files relate to each other, even files not explicitly added to the chat.

The repo map uses tree-sitter for parsing, supporting 100+ languages.

Linting integration

aider --lint-cmd "eslint --fix"  # Auto-lint after every edit
aider --auto-lint                # Use detected linter

Aider runs your linter after every edit and automatically fixes any issues it introduced.

Voice input

aider --voice  # Use speech-to-text for input

Describe changes verbally — useful for complex explanations that are easier to speak than type.

Scripting mode

echo "Add error handling to all API routes" | aider --yes --no-git

Run Aider non-interactively for CI/CD pipelines or batch operations.

Configuration

Create .aider.conf.yml in your project root:

model: claude-3-opus-20240229
weak-model: claude-3-sonnet-20240229
edit-format: diff
auto-lint: true
lint-cmd: eslint --fix
auto-commits: true

Or use environment variables:

export AIDER_MODEL=claude-3-opus-20240229
export AIDER_WEAK_MODEL=claude-3-sonnet-20240229

Cost optimization

Aider can be expensive with frontier models. Tips to reduce costs:

  1. Use --read for context files — read-only files use fewer tokens than editable ones
  2. Use a weak model for simple tasks--weak-model routes simple edits to a cheaper model
  3. Use DeepSeek or Qwen — 10-30x cheaper than Claude/GPT for comparable quality
  4. Truncate large files — Aider sends entire files as context; keep them focused
  5. Use local models for routine work — Ollama with Qwen 3.5 27B is free

Aider vs Claude Code vs Codex CLI

FeatureAiderClaude CodeCodex CLI
Model supportAny modelClaude onlyGPT only
Git integrationDeep (auto-commits)BasicBasic
Repo map✅ Full codebase✅ Full codebase✅ Full codebase
PriceFree (BYOK)$20/mo sub$20/mo sub
Edit qualityModel-dependentExcellentVery good
Voice input
Linting✅ Auto-lint
Open source✅ Apache 2.0

Choose Aider when: You want model flexibility, deep Git integration, or need to use cheap/local models.

Choose Claude Code when: You want the best code quality and don’t mind being locked to Claude.

Choose Codex CLI when: You’re in the OpenAI ecosystem and want fast autonomous coding.

Bottom line

Aider is the Swiss Army knife of AI coding tools. It’s not the best at any single thing — Claude Code writes better code, Codex CLI is faster, Kimi CLI has Agent Swarm. But Aider is the most flexible, the most transparent (Git-native), and the only tool that lets you freely switch between any model from any provider.

For developers who want control over their AI coding workflow without vendor lock-in, Aider is the best choice in 2026.

Related: Aider vs Claude Code vs Codex CLI · Best AI Coding Tools 2026 · Ollama Complete Guide