Aider: AI for Refactoring from the Terminal
Actualizado: 2026-05-03
Aider[1] is a CLI doing what Cursor does but without leaving the terminal. Point at your Git repo, describe what you want changed, it makes changes across multiple files and commits with an auto-generated descriptive message. For developers who live in the terminal — Vim, Emacs, tmux, remote SSH — it is the most pragmatic alternative to graphical AI IDEs.
Key takeaways
- Aider integrates AI into the Git workflow natively: each change is a commit with a descriptive message, compatible with
git log,git blameandgit reset. - The architect/editor split reduces cost: Claude Sonnet or GPT-4o for decisions, DeepSeek or Haiku for mechanical edits.
- For privacy, combining it with local Ollama (Llama 3.1 70B or better) eliminates external dependencies.
- Not a Copilot replacement for inline completion; it is a conversational agent for refactors, features and bug fixes.
- Aider + Copilot — agent for structural changes, completion for line-by-line code writing — is the most productive stack for terminal developers.
What Aider does
Main features:
- Terminal-based: works with any current editor (Vim, Emacs, VS Code, nano).
- Git-native: each change is a commit with auto-generated description.
- Multi-file: edits several files in one request.
- Multiple models: OpenAI, Anthropic, Google, Groq, local Ollama and more.
- Repo map: understands repository structure to give the model relevant context.
- Voice support: Whisper dictation (beta).
Installation and first steps
pip install aider-chat
# With GPT-4o
aider --model gpt-4o --api-key $OPENAI_API_KEY
# With Claude 3.5 Sonnet
aider --model claude-3-5-sonnet-20240620 --api-key $ANTHROPIC_API_KEY
# With local Ollama (private, no per-token cost)
aider --model ollama/llama3.1:70b --openai-api-base http://localhost:11434/v1Basic flow:
cd my-project
aider
> Add JWT authentication to the API endpoints
# Aider reads relevant files
# Makes changes to src/auth.py, src/api.py, tests/test_auth.py
# Shows diff
> /commit
# Committed: "feat: add JWT authentication to API endpoints"Useful commands
/add FILE— include file in context./drop FILE— remove file from context./ls— see currently included files./diff— see current uncommitted changes./commit— commit changes./undo— undo the last Aider commit./clear— reset the conversation./tokens— see token usage in the session./model MODEL— switch model mid-session./voice— dictation.
Where it shines
- Specific refactors: “rename this function and update all callers.”
- Small multi-file features: “add rate limiting to these three endpoints.”
- Bug fixes: describe the bug, Aider investigates relevant files and proposes a fix.
- Migrations: “convert this code from callbacks to async/await.”
- Tests: “add unit tests for all public methods in this file.”
For developers who prefer terminal to IDEs, Aider is productive where Copilot does not reach: changes that cross multiple files and require understanding project structure.
The architect/editor split
Aider supports using two different models in parallel:
- Architect: powerful model (Claude Sonnet, GPT-4o) for design decisions.
- Editor: fast, cheap model (DeepSeek Coder, Haiku) for mechanical edits.
This significantly reduces total cost without losing quality on important decisions:
aider --architect claude-3-5-sonnet-20240620 --editor deepseek/deepseek-coderGit integration: the real differential
Each Aider change generates a commit. This produces effects throughout the workflow:
git log: perfectly readable AI change history.git reset HEAD~1: undo any Aider change in one command.git diff main: see all session changes before pushing.git blame: identify which lines were AI-generated.
For teams, working on a specific branch for the Aider session and reviewing the resulting PR is recommended practice. The GitLab Duo workflow covers the subsequent code review layer.
Aider versus Cursor
| Aspect | Aider | Cursor |
|---|---|---|
| Interface | CLI | GUI (VS Code fork) |
| Editor | Any | VS Code |
| Git integration | Automatic commits | Manual |
| Multi-file | Yes | Yes (Composer) |
| Learning curve | Low for CLI users | Low for VS Code users |
| Models | Many, including local | OpenAI, Anthropic, Ollama |
| Privacy | Configurable (local possible) | Cloud only |
Aider for Vim/Emacs/tmux users. Cursor for VS Code users. Both are valid; not mutually exclusive.
Costs
With GPT-4o:
- Typical request: ~5k input + 500 output tokens.
- Per-conversation cost: $0.02–0.10.
- Active month: ~$20–50.
With local Ollama (Llama 3.1 70B):
- Per-token cost: $0 (after initial hardware).
- Speed: 15–50 tokens/s depending on the Mac.
- Privacy: total, no data leaves the device.
Large repos and monorepos
For large repos, techniques to keep context manageable:
- Add only relevant files:
aider src/payments/ tests/test_payments.pyinstead of opening the whole repo. - Disable repo map:
--no-map-tokens 0on giant repos. - Work by subdirectory:
cd subdir && aider— only that directory as context.
When to choose Aider
- Developer who lives in terminal (Vim, Emacs, tmux, remote SSH).
- You need changes that cross multiple files coherently.
- You value clean AI Git history.
- You want to experiment with different models without lock-in.
- You work in an environment without GUI access.
When to use others
- Continuous inline completion: Copilot is better for line-by-line code writing.
- Prefer GUI: Cursor is better.
- Enterprise with managed billing: Copilot Business/Enterprise has centralised management.
Conclusion
Aider occupies a specific but valuable niche: terminal coding agent with native Git integration. For developers who live in CLI, it is the productive alternative to graphical AI IDEs. Combined with local Ollama it offers full privacy without sacrificing functionality for cases a 70B handles well. For the most complete stack: Aider for refactors and features, Copilot for inline completion, and GitLab Duo for MR review and CI analysis.