Looking for a powerful, private, and free AI pair programmer? Meet Aider, a command-line tool that lets you collaborate with Large Language Models (LLMs) right in your local Git repositories, powered by Ollama.
Why Aider and Ollama?
- Privacy First: Run LLMs locally with Ollama, keeping your code and data secure on your machine.
- Cost-Effective: Avoid expensive cloud API calls.
- Open Source & Customizable: Aider is fully open-source, giving you transparency and the freedom to tailor it to your needs.
- Git Integration: Aider automatically commits changes with descriptive messages, ensuring seamless version control.
- Versatile: Works with various programming languages and development environments.
- Offline Capabilities: Code with AI assistance even without internet connectivity.
Getting Started:
- Install Prerequisites: Python (3.8+) and Git.
- Install Aider:
python -m pip install aider-chat- Or,
curl -LsSf https://aider.chat/install.sh | sh
- Install Ollama: Download from ollama.com
- Start Ollama:
ollama serve - Pull a Model:
ollama pull <model_name>(e.g.,ollama pull).qwen2.5-coder - Relaunch the terminal to enable aider.
Recommended Ollama Models for Software Development:
- qwen2.5-coder: Code-Specific Qwen models, with significant improvements in code generation, code reasoning, and code fixing.
Size 4.7 GBollama pull qwen2.5-coder - deepseek-coder-v2: Specifically trained for code generation and understanding. Size 8.9 GB
ollama pull deepseek-coder-v2
Connecting Aider to Ollama:
- Set Environment Variable:
- macOS/Linux:
export OLLAMA_API_BASE=http://127.0.0.1:11434 - Windows (Command Prompt):
setx OLLAMA_API_BASE http://127.0.0.1:11434(restart shell). - Windows (Powershell):
$env:OLLAMA_API_BASE = "http://127.0.0.1:11434"
- macOS/Linux:
- Run Aider with Model:
First list all the available models using following commandollama list
Now run the following command to start aideraider --model ollama_chat/<model_name>
(e.g.,aider --model ollama_chat/).qwen2.5-coder
Example: Creating a Simple Python Script
- Create a Project Directory:
mkdir my_script && cd my_script - Initialize Git:
git init - Run Aider:
aider --model ollama_chat/qwen2.5-coder - Ask Aider to Create a Script: “Create a python script called
greet.pythat prints ‘Hello, Aider!’”
Aider will create greet.py, add the code, and commit the changes. You can close aider by pressing Control + c
You can then run the script to test the code: python greet.py
Key Aider Commands:
/add <file>: Add files to the chat./drop <file>: Remove files from the chat./undo: Undo the last Aider commit./diff: Show the last Aider commit diff./run <command>: Run a shell command./ask <question>: Ask questions without code changes./code <instruction>: Apply code changes./architect <instruction>: Propose changes before applying.
Tips for Effective Usage:
- Experiment with different Ollama models.
- Manage the context window size.
- Use Aider’s in-chat commands efficiently.
- Provide clear and specific instructions.
Aider and Ollama empower you to code with AI assistance, maintaining full control and privacy. Start exploring the possibilities today!
Experimental UI:
https://aider.chat/docs/usage/browser.html
Additional Links:
- Aider GitHub: https://github.com/Aider-AI/aider
- Ollama Documentation: https://olama.com/
- Aider Ollama Integration: https://aider.chat/docs/llms/ollama.html
- Aider Troubleshooting: https://aider.chat/docs/troubleshooting.html
If you’re looking for a powerful, free, and private AI coding assistant, Aider with Ollama is worth exploring.g your coding journey. And with the combination of Ollama and Gemma 3, you’re getting a truly local and capable AI coding partner!
Akash Gupta
Senior VoIP Engineer and AI Enthusiast

AI and VoIP Blog
Thank you for visiting the Blog. Hit the subscribe button to receive the next post right in your inbox. If you find this article helpful don’t forget to share your feedback in the comments and hit the like button. This will helps in knowing what topics resonate with you, allowing me to create more that keeps you informed.
Thank you for reading, and stay tuned for more insights and guides!
Leave a comment