Aider — Quick reference

Open-source AI pair programmer in your terminal · edits your files & auto-commits to Git · bring your own LLM key · 100+ languages · macOS / Windows / Linux

At a glance

Aider turns your terminal into an AI coding session. You point it at one or more files, describe a change in plain English, and it edits those files and immediately commits the change to Git with a descriptive message — so every AI edit is a clean, reversible commit and nothing is silently overwritten. It is free and open-source (Apache 2.0); you pay only your chosen LLM's token cost (bring your own key). Terminal-only — there is no GUI, so basic command-line confidence helps.

Setup & first edit

1 · Start a session on a file

# needs an LLM API key (here, Claude Sonnet)
aider --model sonnet analysis.py

2 · Type a request in plain English

Read data.csv and print the mean ± SD
for every numeric column.

Aider writes analysis.py, prints the diff, then auto-commits the change to Git with a sensible message — the change is saved and reversible from the very first edit. Aider itself is free; you only pay the model's per-token cost.

Key commands & shortcuts

CommandWhat it does
aider --model sonnet file.pyStart a session with a chosen model on one or more files
/addAdd files to the chat so aider can edit them
/dropRemove files from the chat to free up context space
/read-onlyAdd files for reference only (or make added files read-only)
/askAsk questions about the code base without editing any files
/codeAsk for changes to your code
/architectEnter architect/editor mode using 2 different models
/undoUndo the last git commit if it was done by aider
/diffDisplay the diff of changes since the last message
/lintLint and fix in-chat files (or all dirty files)
/testRun a shell command, add output to the chat on non-zero exit
/runRun a shell command and optionally add the output to the chat
/tokensReport tokens used by the current chat context (live spend)
/modelSwitch the main model to a new LLM
/modelsSearch the list of available models
/webScrape a web page, convert to markdown, send it in a message
/voiceRecord and transcribe voice input
/pastePaste an image / text from the clipboard into the chat
/mapPrint out the current repository map
/clearClear the chat history
/resetDrop all files and clear the chat history
/commitCommit edits to the repo made outside the chat
/helpAsk questions about aider

Prompting patterns

First edit
One sentence → working code
"Read data.csv and print the mean ± SD for every numeric column." Aider writes the script and commits it. Works in any language you like.
Iterate
Follow up in the same session
"Also write the results to a summary.csv file, and skip any columns that are completely empty." Each instruction is its own clean commit.
Verify
Ask for a test, then run it
"Add a small test that checks the mean is calculated correctly, then run it." Aider lints and tests after the change and fixes what it finds.
Multi-file
Refactor across files
"Move the column-parsing logic into a helpers.py module and update analysis.py to import it." Aider edits both and commits each coherent change.
Small steps
One clear request at a time
Focused requests give the model less to misread and keep each commit easy to review — and cheaper, since related changes in one message spend fewer tokens.
Rich input
Match a screenshot or doc page
Hand Aider an image or web page as context and ask it to "match what's shown" — the model sees the reference, not just your description.

Context & modes

Add files & context

# start on several files at once
aider --model sonnet analysis.py helpers.py
# or add / drop during the session
/add utils.py
/read-only schema.sql
/web https://example.com/api-docs
/paste   # image or text from clipboard

Aider maps your codebase (/map), so the model reasons about callers and definitions in files it isn't directly editing — no need to paste every file in.

Chat modes

codeDefault — makes changes to your code edits
askDiscuss code, answer questions, never changes files
architectAn architect model proposes, an editor model applies edits
helpAnswers questions about aider itself

/ask · /code · /architect · /help switch for one message; /chat-mode <mode> switches persistently; or launch with --chat-mode <mode> (--architect is a shortcut). The prompt shows the mode, e.g. ask>.

Pick a model

aider --model sonnet           # Claude Sonnet (frontier)
aider --model o3 / o4-mini     # OpenAI reasoning models
aider --model gpt-4.1          # OpenAI GPT-4.1
aider --model gemini-2.5-pro   # Google Gemini 2.5 Pro
aider --model deepseek         # DeepSeek R1 / V3 (cheaper)

Aider works with virtually any LLM, and can run free local models via Ollama for zero token cost on routine edits. Consult Aider's public polyglot leaderboard (225 Exercism exercises across C++, Go, Java, JavaScript, Python and Rust) — it reports each model's success rate alongside its cost, so you can pick a cheaper model that still does the job. Switch live with /model.

Pricing & limits

WhatCost
Aider itselfFree & open-source (Apache 2.0) — no subscription, no lock-in
Your LLM tokensYou pay your model provider per token — cost depends on the model you pick (a frontier model like Claude Sonnet costs more; a small or local model costs little to nothing)
Local models via Ollama$0 token cost
/undo & lint/test passesFree — /undo is a Git revert; lint/test run locally on your machine

You bring your own LLM API key and pay the provider directly. Aider reports the token count and dollar cost of each interaction in the terminal — use /tokens to see the running total for the current context, so you can watch spend live whatever model you choose.

Gotchas & tips

Every edit is a Git commit — so /undo cleanly reverts the last AI commit and every experiment is safe to try; keep changes small so each commit is easy to review. It's a code editor, not a writing tool — less useful for lab reports or literature reviews. Cost is real — a heavy session on a frontier model adds up, so pick an economical model from the leaderboard for routine work and keep image / web-page context focused (larger context = more tokens per request). Windows: WSL2 gives the smoothest experience.