Terminal AI Coding (Aider + Ollama)
Aider + Ollama = Claude Code/Cursor alternative in your terminal. Git-aware, auto-commits, works with any local model. Your code never leaves your machine.
Terminal AI Coding (Aider + Ollama) is a local AI stack for AI pair programming in your terminal with local models, fully private. Aider + Ollama = Claude Code/Cursor alternative in your terminal. Git-aware, auto-commits, works with any local model. Your code never leaves your machine. It combines 6 components, is rated intermediate, and takes about 10 minutes to set up. Expect around $800 in hardware and $0/month versus cloud.
- Cost
- ~$800
- $0/mo vs cloud
- Difficulty
- intermediate
- Setup time
- ~10 min
- Use case
- AI pair programming in your terminal with local models, fully private
~$800 hardware · $0/mo vs cloud
Terminal AI Coding (Aider + Ollama)
AI pair programming in your terminal, entirely local. Aider is an open-source terminal-based AI coding assistant (44K+ GitHub stars) that edits files directly in your repo, creates sensible git commits, and works with any LLM. Connect it to Ollama for local inference, and you get a fully private alternative to Claude Code, Cursor, or GitHub Copilot.
What you get
- AI code edits in your terminal - describe a change, Aider edits your files
- Git-native - auto-commits with sensible messages, easy to diff/undo
- Codebase-aware - maps your entire project for context-aware changes
- 100+ languages - Python, JS, Rust, Go, C++, and everything else
- Lint + test integration - auto-fix issues found by your linters
- Fully private - all inference runs on your GPU, zero data leaves your machine
- $0/month - no API costs, no per-seat licenses
Architecture
| Component | Role |
|---|---|
| Aider | Terminal AI coding assistant (CLI tool) |
| Ollama | Serves the coding model locally |
| Qwen3 Coder 30B A3B | Fast MoE coding model - 3B active params |
For most users, Qwen2.5 Coder 14B is a great fit on a 24GB card. For faster responses, the Qwen3 Coder 30B A3B MoE model uses only 3B active parameters per token. Recommended GPU: RTX 3090 (best value 24GB) or RTX 4090.
Prerequisites
- Python 3.9+
- Ollama installed and running
- A coding model pulled in Ollama
- Git initialized in your project
Setup
Step 1: Install Aider
python -m pip install aider-install
aider-installStep 2: Pull a Coding Model
ollama pull qwen2.5-coder:14bStep 3: Start Ollama with Larger Context
Ollama defaults to 2K context window, which is too small for coding. Start it with 8K+:
OLLAMA_CONTEXT_LENGTH=8192 ollama serveStep 4: Start Coding
cd /your/project
aider --model ollama_chat/qwen2.5-coder:14bAider will analyze your repo structure, create a git commit if needed, and present you with a chat prompt. Describe what you want to build or change.
Use it
Add a Feature
> Add a rate limiter to the API endpoint using a decorator patternAider reads your codebase, finds the right files, and makes the edit. It then shows you the diff and asks if you want to commit.
Fix a Bug
> The login endpoint throws a 500 when the email field is empty. Fix it.Aider finds the handler, adds validation, and commits the fix.
Refactor Code
> Extract the database logic from views.py into a separate repository layerAider creates the new file, updates imports, and moves the code.
Write Tests
> Write pytest tests for the user registration flowAider generates tests based on your existing code patterns.
Cost vs cloud
| Local Aider + Ollama | Cursor / Claude Code | |
|---|---|---|
| Monthly | $0 | $20-100 |
| Hardware | ~$800 once (3090) | $0 |
| Code privacy | Never leaves you | Uploaded to vendor |
| Model choice | Any local model | Limited providers |
| Git workflow | Auto-commit + diff | Manual or limited |
For a solo dev, the 3090 pays for itself in about 8 months vs Cursor Pro. For teams under IP/compliance restrictions, it's the only option that works.
Troubleshooting
- Aider can't connect to Ollama → Make sure
ollama serveis running. SetOLLAMA_API_BASE=http://127.0.0.1:11434. - Context too small → Always start Ollama with
OLLAMA_CONTEXT_LENGTH=8192or higher. Aider will also warn if the window is too small. - Slow responses → Use a smaller quant (Q4_K_M) or a coding-specific model. The MoE Qwen3 Coder 30B A3B is fastest for its size.
- Model warnings → Aider shows warnings for unfamiliar models. You can suppress them by adding an
.aider.model.settings.ymlfile. - Aider won't install → Make sure pip is up to date:
python -m pip install --upgrade pip.
Swap components
- Larger model → Qwen3 Coder 30B A3B on an RTX 4090 for sharper reasoning.
- Smaller/8GB GPU → Qwen2.5 Coder 7B or Llama 3.1 8B.
- VS Code GUI → Use Continue instead of Aider for an in-editor experience.
- Terminal agent → Try Open Interpreter for a more agentic approach.
Frequently asked
What is the Terminal AI Coding (Aider + Ollama) stack for?
Aider + Ollama = Claude Code/Cursor alternative in your terminal. Git-aware, auto-commits, works with any local model. Your code never leaves your machine. It is purpose-built for AI pair programming in your terminal with local models, fully private and runs entirely on your own hardware.
How much does the Terminal AI Coding (Aider + Ollama) stack cost?
Terminal AI Coding (Aider + Ollama) costs around $800 in hardware up front and $0/month to run, since everything is self-hosted — no per-token or subscription fees versus a cloud equivalent.
How long does it take to set up Terminal AI Coding (Aider + Ollama)?
Plan for roughly 10 minutes. The stack is rated intermediate.
What do I need to run Terminal AI Coding (Aider + Ollama)?
Terminal AI Coding (Aider + Ollama) is built from 2 tool(s), 2 model(s), 2 hardware item(s). Each is listed below with a link.