How to configure Aider with Ollama to program with local AI

Last update: 25/08/2026

  • Aider allows the integration of local language models using Ollama to edit code directly in Git repositories.
  • Using the ollama_chat/ prefix is ​​essential for achieving better results in code generation than the standard prefix.
  • Managing the context window through configuration files is key to preventing AI from losing its way in large projects.
  • The combination of architect mode and repository map optimizes the performance of smaller local models.
aider with ollama

 

If you're tired of paying monthly subscriptions for code assistants or worried about your intellectual property ending up on a large corporation's servers, you've come to the right place. Imagine having a super-intelligent programming companion living on your own machine, capable of writing entire functions, fixing bugs, and managing your Git commits without a single byte of data leaving your computer. That's precisely the magic of combine Aider with Ollama, an advanced terminal agent alongside the queen tool for running local LLMs.

The best part is that you don't need to be an expert in AI deployments to get this up and running. Although Aider It can work with giants like Claude or GPT-4, its capacity to connect to local models This makes it an unbeatable option for those seeking complete privacy at zero cost. In the following lines, I'll explain step-by-step how to set up this ecosystem, from the most basic installation to expert tips to ensure the AI ​​doesn't get stuck on large projects.

Exclusive content - Click Here  How does Flash Builder speed up development?

Installation and commissioning

 

To begin, you need to have Python (version 3.9 or higher) and Git installed on your system. The quickest and cleanest way to install Aider is using the Bootstrap installer by running python -m pip install aider-install followed by aider-installIf you prefer to keep your system pristine and avoid dependency conflicts, I recommend using uv tool install –force –python python3.12 –with pip aider-chat@latestwhich creates an isolated and efficient environment.

Once Aider is installed, you need to Ollama is running in the background. For AI to be truly useful in programming, not just any model will do; you need one specialized in code. A prime candidate is qwen2.5-coder:14bwhich offers a fantastic balance between quality and resource consumption. You can download it by running ollama pull qwen2.5-coder:14b on your console.

Connection setup

To configure Aider with Ollama, you need to define the server address. On Mac or Linux systems, you can use export OLLAMA_API_BASE=http://127.0.0.1:11434, while in Windows (PowerShell) you will need to use setx OLLAMA_API_BASE http://127.0.0.1:11434 and restart the terminal for the change to take effect. It's a simple detail, but if you skip this step, the agent won't be able to find the model.

When launching the tool, there's a vital trick that many people overlook: the model prefix. To get consistent responses and for the AI ​​to follow editing instructions, you must use –model olivama_chat/qwen2.5-coder:14bIt is essential to add the ollama_chat/ instead of just ollama/Since the chat endpoint is optimized for the type of prompts that Aider sends, avoiding annoying errors and mediocre results.

Exclusive content - Click Here  How to install an MCP server step by step
How to configure Aider with Ollama
How to configure Aider with Ollama

Mastering the context window

 

One of the most common problems when using local models is that, by default, Ollama usually comes with a very limited context window (around 2048 tokens). For a software project, this is simply insufficient and causes problems. AI forgets parts of the code or ignore previous instructions without warning. Attempting to change it from the Ollama CLI usually doesn't work because Aider launches its own configuration on startup.

The definitive solution (in the case of Aider with Ollama) is to create a file called .aider.model.settings.yml in the root directory of your project. Within this file, you must specify the model name and the parameter num_ctxFor example, setting it to 32768 tokens will allow the model to handle much more information simultaneously. However, be careful: the amount of VRAM on your graphics card This will determine how much you can increase this value before performance plummets.

Advanced Workflows: Architect and Repository Map

 

Combining Aider with Ollama in local models sometimes causes them to struggle when they have to think about the architecture and write the code simultaneously. To solve this, Aider implements the architect modeIn this workflow, AI first designs a detailed plan in natural language, and then an editing model translates that plan into precise file changes. You can activate it with –architect or using the command /architect within the chat.

To prevent a small model from getting lost in a sea of ​​files, Aider uses a repository mapThis tool creates a project skeleton with the signatures of the main classes and functions, allowing AI to understand the relationships between files without needing to read all the source code. To add specific files to the current context so that AI can edit them, use the command /add filename.

Exclusive content - Click Here  How 1Password's anti-phishing works
How to install Aider on Windows step by step
How to configure Aider with Ollama

Combining Aider with Ollama: comparison and final tips

If you're wondering which model to choose based on your hardware, the general rule is: for 12GB or 16GB cards, the Qwen2.5-Coder-14B It's the most sensible option. If you have a 24GB beast, you can jump to the 32GB version for greater precision. For those seeking pure speed, the DeepSeek-Coder-V2-Lite It is surprisingly fast thanks to its MoE architecture.

Unlike IDE-integrated tools like Cline or Goose, Aider focuses on the terminal and the Native integration with GitEvery change the AI ​​makes is automatically confirmed with a descriptive message. This is a blessing, because if the AI ​​makes a mistake, you can run /world to instantly revert the last commit, returning your code to its previous state without complications.

Having a programming system based on integrating Aider with Ollama transforms the terminal into a command center where code is automatically written, tested, and versioned. By correctly setting the model prefix, expanding the context window using YAML files, and leveraging architect mode, any developer can have a free, private AI agent that doesn't compromise data security or workflow performance.