Skip to content

Aider

Aider is a terminal coding agent that edits files in your repo and commits the results. It talks to any OpenAI-compatible endpoint, which makes it the one agentic workflow that works against lean serve today - it applies edits by having the model rewrite text, not by calling tools.

Aider does not yet install cleanly on Python 3.14 - one of its dependencies has no wheel, and the source build fails. Use 3.12:

Terminal window
python3.12 -m venv ~/.aider-venv
~/.aider-venv/bin/pip install aider-chat
Terminal window
lean serve lean-agent-light --port 8080

Leave it running in its own terminal. The first request loads the model and warms the expert cache, so it is slower than the ones after it.

Terminal window
export OPENAI_API_BASE=http://127.0.0.1:8080/v1
export OPENAI_API_KEY=dummy
~/.aider-venv/bin/aider --model openai/lean-agent-light

Three things to note:

  • The openai/ prefix tells Aider to use its OpenAI-compatible driver. The part after it must match the model id the server reports at /v1/models.
  • OPENAI_API_KEY must be set to something, even when the server has no key configured. If you started lean serve with --api-key, put the real key here.
  • No --edit-format flag. Aider negotiates it, and the default is the one you want (see below).

Aider auto-selects the whole edit format for these models, where the model reproduces each edited file in full. That is the format to stay on.

The alternative, diff, asks the model to emit SEARCH/REPLACE blocks. On the 35B this does not work: the blocks fail to apply, Aider retries, and a single edit runs past ten minutes without converging. The server stays healthy throughout - this is a limit of the model’s precision at that quant, not a server bug. Do not pass --edit-format diff.

Reasoning shows up in Aider’s own THINKING panel rather than leaking into the file it is editing, because the server splits the <think> block into reasoning_content.

A typical edit on a small file is roughly 700 tokens of prompt and 150 tokens of response, which on lean-agent-light is a handful of seconds.

whole rewrites the entire file on every edit. That is fine on focused files of a few hundred lines and painful on a 2,000-line module, where each edit costs you a full regeneration at local decode speed. Treat Aider on a lean model as a tool for working on specific files, not for turning it loose on a whole repository.

If edits feel slow, the usual fixes are: add fewer files to the chat (/drop what you are not editing), split large files, and use a smaller model rather than a larger one - decode speed matters more here than raw capability.

Symptom Cause
Connection refused lean serve is not running, or is on a different port.
401 from the server Server started with --api-key; set OPENAI_API_KEY to that key.
Model name not found The name after openai/ must match /v1/models.
Edits never apply, requests take many minutes You are on --edit-format diff. Drop the flag.
pip install fails building a dependency You are on Python 3.14. Use 3.12.