How to use Aider with Ollama for local programming

Last update: 16/08/2026

  • Integration of Aider AI with local Ollama models to guarantee total privacy and zero cost.
  • Critical configuration of the ollama_chat/ prefix and adjustment of the context window using YAML files.
  • Using architect mode and repository map to maximize the efficiency of small local models.
  • Differentiation between Aider, Cline and Goose according to workflow preference (terminal vs IDE).
Developer writing Python code on a mechanical keyboard with an on-screen code editor, representing the programming workflow.

Have you ever felt that programming alone is a bit tedious or that you're missing that partner to lend a hand with the more complicated bugs? Well, Use Aider with Ollama It allows you to have an advanced programming assistant that lives directly in your terminal and integrates seamlessly with your Git repositories.

The most powerful thing about it is that, if you're worried about the privacy of your code or don't want to spend your entire paycheck on cloud API subscriptions, you can combine it with Ollama. This pairing allows all processing to happen on your own hardware, ensuring your code never leaves your machine. and that the cost per token is simply zero.

What exactly is Aider AI and why is it so interesting?

Aider It's not your typical code autocomplete that just suggests the next line. It's a coding agent A comprehensive tool that maps your codebase, understands the relationships between files, and allows you to make real edits across multiple documents simultaneously. What makes it shine is its native nature of GitEach time the assistant makes a change, it creates a commit with a descriptive message, meaning you can undo any AI blunder with a simple command.

Exclusive content - Click Here  Claude integrates Slack, Figma, and Asana: this is how teamwork is changing with AI

Being an open-source tool under the Apache 2.0 license, it is extremely flexible. You can use it in the terminal, configure a experimental browser environment using the command --browser For those who prefer a visual interface, or even integrate voice commands if you install additional libraries like PortAudio.

Use Aider with Ollama
How to use Aider with Ollama

Steps to start using Aider with Ollama

For everything to work smoothly, to use Aider with Ollama you first need to have Python (version 3.9 or higher) and Git installed. The quickest way to install Aider is through its quick installer. python -m pip install aider-install followed by aider-installHowever, for purists who prefer to keep the system clean, using uv tool install It is the recommended option.

Once Aider is installed, the next step is to prepare the brain of the operation in Ollama. You must download a specialized code model, being qwen2.5-coder:14b The top recommendation for its balance between power and VRAM consumption. To bridge these two worlds, configuring the environment variable is essential. OLLAMA_API_BASE pointing to http://127.0.0.1:11434In Windows this is done with setx and on Mac or Linux with export.

The master trick: the ollama_chat prefix

This is where many people go wrong when trying to use Aider with Ollama and end up frustrated because the model doesn't respond well. Aider offers two ways to connect with OllamaHowever, the developers strongly recommend using the prefix ollama_chat/ instead of just ollama/For example, you should launch the tool like this: aider --model ollama_chat/qwen2.5-coder:14b.

This small difference in nomenclature causes Aider to use the chat endpoint Ollama, which handles prompting much better and produces much more precise and cleaner code edits, preventing the model from getting lost along the way.

Exclusive content - Click Here  How to save songs to your Spotify library
Ollama not downloading models: causes and solutions
Use Aider with Ollama

Context window optimization

If you notice that Aider is forgetting parts of your code or giving you warnings about the token limit, it's because Ollama comes by default with a 2k context window, which is ridiculously small For programming. Aider tries to adjust it automatically, but for serious projects it's best to set a larger size.

The solution is to create a file called .aider.model.settings.yml in the root directory of your project. Inside, you must define the parameter num_ctx (for example, 32768). The higher you increase this value, the greater the AI's ability to analyze the repository map, provided that your graphics card (VRAM) can withstand it without collapsing.

Recommended models and working modes

Not all local models are the same. And that affects how you use Aider with Ollama. For those with modest GPUs (12GB-16GB), the Qwen2.5-Coder-14B That's the sweet spot. If you have a 24GB beast, you can jump to the 32GB version for deeper performance. For those who prioritize pure speed, DeepSeek-Coder-V2-Lite It's an incredibly fast option thanks to its MoE architecture.

In addition, Aider offers different interaction modes that you can switch on the fly with slash commands:

  • Code Mode (default): To make direct changes to the files.
  • Architect Mode: Ideal for local models. First, plan the solution in prose, and then execute it, which It drastically reduces errors of format.
  • Ask Mode: To resolve conceptual doubts without AI touching a single line of your code.
Exclusive content - Click Here  Complete Guide to Managing Multiple Models in Ollama Without Conflicts

To enhance this, Aider uses a Repo MapThis is essentially a simplified schema of your entire project. It allows small models to understand the overall architecture without loading thousands of lines of code into memory, thus optimizing the use of local resources.

Quick Comparison: Aider vs Cline vs Goose

If you're hesitating between several local tools, the key is where you want to work. Aider is the definitive option if you're a lover of the terminal and GitIf you prefer not to leave Visual Studio Code and want an agent that asks for your permission before each change, Cline It's your best bet. On the other hand, Goose It's ideal if you're looking for a standalone agent with a broad ecosystem of MCP extensions. Many developers end up using Aider for quick edits and Cline for tasks more integrated within the editor.

Using Aider with Ollama, that is, implementing this local workflow, transforms the development experience by eliminating cloud dependencies and recurring costs. By mastering context configuration, choosing the right model, and using architect mode, any programmer can turn their computer into a autonomous workstation capable of refactoring code, creating new features and debugging errors with total privacy and absolute control over the change history through Git.