Skip to main contentThe Local Bench

How-to · Intermediate · about 30 min · reviewed 2026-10-13

Connect a local model to a coding agent (Aider + Ollama)

Pair-program in your terminal with a model running on your own machine. Aider edits files in your git repository and commits each change; Ollama serves the model.

warning icon
Sourced, not yet tested.
Commands are copied from the Aider and Ollama documentation (checked 2026-10-13). We have not yet run this guide on our bench, and we have not yet measured how well local models do in Aider.

Before you start

24 GB GPU or 32 GB+ unified memory for qwen3-coder:30b; 12–16 GB GPU for smaller coding models, with weaker results. Linux, macOS, Windows.

  • Python 3 with pip
  • git, and a project that is a git repository
  • Ollama installed (see "Run your first local model")
Start guide
  • Software and cost

    $0 · free software; a 24 GB GPU or 32 GB+ unified memory for 30B-class coding models

    Tested on

    Last tested: not yet

    Not yet run on our bench.

    Not yet tested by us

    • The whole guide end to end
    • Edit quality of qwen3-coder:30b in Aider
    • The .aider.model.settings.yml example with this model name
  1. Install Aider

    python -m pip install aider-install
    aider-install

    aider-install sets Aider up in its own isolated environment, so it won't clash with your other Python packages.

  2. Tell Aider where Ollama is

    On macOS or Linux:

    export OLLAMA_API_BASE=http://127.0.0.1:11434

    On Windows (restart the shell afterwards):

    setx OLLAMA_API_BASE http://127.0.0.1:11434
  3. Pull a coding model and start Ollama with more context

    ollama pull qwen3-coder:30b
    OLLAMA_CONTEXT_LENGTH=8192 ollama serve

    Leave that terminal running. On a 12–16 GB card, pick a smaller coding model from the Ollama library instead.

    info icon
    Context and Aider

    Aider's docs say it sizes Ollama's context window for each request (your request plus 8K tokens for the reply), so files aren't silently cut off. You can pin a fixed size instead with a settings file (see troubleshooting).

  4. Start Aider in your project

    In a second terminal:

    cd /to/your/project
    aider --model ollama_chat/qwen3-coder:30b

    Aider recommends the ollama_chat/ prefix over ollama/. It may print warnings about models it doesn't know; the Aider docs explain these and they're usually safe to ignore.

    warning icon
    Aider edits and commits

    Aider writes changes to your files and commits them to git. Work on a branch, and review with git diff or /undo inside Aider if a change is wrong.

  5. Verify it works
    Check

    Add a file to the chat and ask for a small, checkable change:

    /add README.md
    Add a one-line "Requirements" section that says Python 3.10 or newer.

    Aider should show a diff, apply it, and make a commit. Confirm with:

    git log --oneline -1

    The latest commit should be Aider's, describing the README change.

Troubleshooting

  • Check that ollama serve is running and that curl http://127.0.0.1:11434 replies "Ollama is running". On Windows, open a new terminal after setx so the variable is loaded.

  • Smaller and heavily quantized models struggle with Aider's edit formats. Try a larger model, or a higher-precision tag. Model choice matters more here than in plain chat.

  • Create .aider.model.settings.yml in your project or home directory. The Aider docs give this shape (use your model's name):

    - name: ollama/qwen2.5-coder:32b-instruct-fp16
      extra_params:
        num_ctx: 65536

    A larger num_ctx needs more memory for the KV cache.

  • Continue brings the same local model into VS Code or JetBrains: autocomplete, chat and edits. Its docs have a dedicated Ollama guide.

Sources

  1. Aider docs: connecting to Ollama
  2. Ollama library: qwen3-coder
  3. Ollama docs: context length
  4. Continue docs: using Ollama (alternative for VS Code / JetBrains)

Markdown: /how-to/local-model-coding-agent-aider.md · JSON: /api/v1/how-to/local-model-coding-agent-aider.json