Aider + Ollama Setup
Configure Aider to use local Ollama models for fast, private AI-powered coding without cloud API costs.
What This Does
This skill sets up Aider with Qwen2.5-Coder models running locally via Ollama. You get:
**Fast coding assistant** without API rate limits or costs**Complete privacy** - all code stays on your machine**Smart dual-model setup** - powerful 7B model for complex tasks, fast 3B model for simple edits**Git integration** - automatic commits with descriptive messages**Optimized context** - efficient token usage for better performancePrerequisites
1. **Install Ollama**: [ollama.com](https://ollama.com)
2. **Pull models**:
```bash
ollama pull qwen2.5-coder:7b
ollama pull qwen2.5-coder:3b
```
3. **Install Aider**:
```bash
pip install aider-chat
```
Instructions
Step 1: Create Configuration File
Create `~/.aider.conf.yml` with the following content:
```yaml
Default model - Qwen2.5-Coder 7B (Fast & Smart!)
model: ollama/qwen2.5-coder:7b
Weak model for simpler tasks (faster)
weak-model: ollama/qwen2.5-coder:3b
Edit format - how aider makes changes
edit-format: diff
Git integration
auto-commits: true
dirty-commits: true
auto-lint: true
Output preferences
pretty: true
stream: true
dark-mode: true
Show git diffs when reviewing changes
show-diffs: true
Map settings (code context)
map-tokens: 2048
map-refresh: auto
Chat history
restore-chat-history: true
Don't show model warnings for local models
show-model-warnings: false
```
Step 2: Verify Ollama is Running
```bash
Check Ollama status
ollama list
Should show qwen2.5-coder models
```
Step 3: Test Aider
```bash
Start aider in your project
aider
Try a simple command
/help
```
Step 4: Start Coding
```bash
Add files to edit
/add src/main.py
Make changes
> Add error handling to the main function
Review changes before committing
/diff
Commit when ready
/commit
```
Configuration Details
Model Strategy
**qwen2.5-coder:7b** - Main model for complex refactoring, architecture decisions, bug fixes**qwen2.5-coder:3b** - Weak model for simple edits, comments, formattingGit Integration
`auto-commits: true` - Automatically creates commits after changes`dirty-commits: true` - Allows commits even with uncommitted changes`auto-lint: true` - Runs linters before committing`show-diffs: true` - Shows git diffs when reviewingContext Management
`map-tokens: 2048` - Limits context size for faster responses`map-refresh: auto` - Automatically updates code map as you workUX Settings
`pretty: true` - Enhanced terminal formatting`stream: true` - Real-time response streaming`dark-mode: true` - Dark theme for terminalCustom Ollama Connection
If Ollama runs on a different host or port:
```yaml
Add to ~/.aider.conf.yml
openai-api-base: http://your-host:11434/v1
```
Usage Tips
1. **Start with context**: Add relevant files with `/add` before making requests
2. **Review before committing**: Use `/diff` to see changes before they're committed
3. **Use architect mode**: For big changes, use `/architect` to plan before coding
4. **Drop unnecessary files**: Use `/drop` to remove files from context and save tokens
5. **Undo mistakes**: Use `/undo` to revert the last aider commit
Why Qwen2.5-Coder?
**Code-specialized**: Trained specifically for programming tasks**Fast**: 7B model runs smoothly on consumer hardware**Smart**: Competitive with much larger models on code tasks**Free**: No API costs or rate limitsTroubleshooting
**Ollama not connecting?**
```bash
Check Ollama is running
curl http://localhost:11434/api/tags
```
**Model not found?**
```bash
Verify models are downloaded
ollama list
ollama pull qwen2.5-coder:7b
```
**Slow performance?**
Use the 3B model: `aider --model ollama/qwen2.5-coder:3b`Reduce map-tokens: Set `map-tokens: 1024` in configClose other apps to free RAMAlternative Models
Want to try different models? Edit `~/.aider.conf.yml`:
```yaml
DeepSeek Coder (33B - more powerful, slower)
model: ollama/deepseek-coder:33b
CodeLlama (13B - good middle ground)
model: ollama/codellama:13b
Llama 3 (general purpose)
model: ollama/llama3:8b
```
Then pull the model: `ollama pull model-name`
Documentation
[Aider Docs](https://aider.chat/docs/config.html)[Ollama Models](https://ollama.com/library)[Qwen2.5-Coder](https://ollama.com/library/qwen2.5-coder)