AI and VoIP Blog

VOIP | AI | Cloud | Kamailio | Open Source


Aider: Your Open-Source, Fully Local, and 100% Free AI Pair Programmer (with Ollama)


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:

  1. Install Prerequisites: Python (3.8+) and Git.
  2. Install Aider:
    • python -m pip install aider-chat
    • Or, curl -LsSf https://aider.chat/install.sh | sh
  3. Install Ollama: Download from ollama.com
  4. Start Ollama: ollama serve
  5. Pull a Model: ollama pull <model_name> (e.g., ollama pull qwen2.5-coder).
  6. 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 GB
    ollama 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:

  1. 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"
  2. Run Aider with Model:
    First list all the available models using following command
    ollama list
    Now run the following command to start aider
    aider --model ollama_chat/<model_name>
    (e.g., aider --model ollama_chat/qwen2.5-coder).

Example: Creating a Simple Python Script

  1. Create a Project Directory:
    mkdir my_script && cd my_script
  2. Initialize Git: git init
  3. Run Aider: aider --model ollama_chat/qwen2.5-coder
  4. Ask Aider to Create a Script: “Create a python script called greet.py that 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:

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!

Join 753 other subscribers

Leave a comment

Akash Gupta
Senior VoIP Engineer and AI Enthusiast



Discover more from AI and VoIP Blog

Subscribe to get the latest posts sent to your email.



One response to “Aider: Your Open-Source, Fully Local, and 100% Free AI Pair Programmer (with Ollama)”

  1. Do you still use this tool? Which model do you use now?

    I’ll give it a try with gemma3:4b

    Like

Leave a comment