
# Aider

[Aider](https://aider.chat/) is a terminal pair-programming agent. It
reaches any OpenAI-compatible endpoint through its `openai/` model
prefix, which is what makes it work with LowRouter.

Verified against Aider **v0.86.0**. The config below is re-run against
that release every week.

## Configure

Aider reads the endpoint and key from the environment:

<!-- verify: aider-env -->
```bash
export OPENAI_API_BASE=https://api.lowrouter.ai/v1
export OPENAI_API_KEY=sk-lr-...
```

Then start it with the model name prefixed by `openai/`:

```bash
cd /your/project
aider --model openai/auto/mistralai/mistral-large-2512
```

The prefix is easy to miss. Aider decides where to send a
request from the model name's prefix: `openai/` means "send this to
whatever `OPENAI_API_BASE` points at", and everything after it is
passed through unchanged as the model. So the full name is `openai/`
followed by any ID from the [model browser](/models):

| You want | `--model` |
|---|---|
| LowRouter picks the route | `openai/auto/mistralai/mistral-large-2512` |
| A pinned provider | `openai/anthropic/anthropic/claude-sonnet-5` |
| A pinned region | `openai/aws-bedrock/mistralai/ministral-3-3b-instruct/br-gru` |

`OPENAI_API_BASE` ends in `/v1`, with no trailing slash, because Aider appends
`/chat/completions` itself.

You will see a warning on start-up that Aider does not know the model
("Unknown context window size and costs"). It is harmless: Aider works
with a model it has no metadata for, and the real cost of every
request is in your [Activity](/app/activity). Silence it with
`--no-show-model-warnings`.

## Picking a model

Aider does not use function calling. It asks the model for edits in a
text format it parses itself, so any chat model works. Look for good
instruction following on code and a context window big enough for the
files you add to the chat. The [model browser](/models) tags context
length per model.

## Recommended setup

- Use a dedicated key. Aider re-sends the files in the chat on every
  turn, so a long session with large files spends quickly, and a key
  of its own makes that spend visible on the Activity page and
  revocable on its own.
- Pin the route with an explicit model ID for repeatable pricing.
  An `auto/` ID keeps the model fixed but may serve it from a
  different provider or region, with the same output at a different
  per-token price.
- Read the diff. Aider commits to your repository by default; run
  with `--no-auto-commits` until you trust the model on your codebase.

## Troubleshooting

- **`401`**: the key is not exported, or was exported in another
  shell. Aider reads `OPENAI_API_KEY` at start-up.
- **`404`**: `OPENAI_API_BASE` is missing `/v1`, or has a trailing
  slash.
- **"Model … is not supported" or a `BadRequestError` naming the
  model**: the `openai/` prefix is missing. Without it Aider tries to
  route the name through another provider's SDK.
- **Latency feels off**: check the **provider** field on the request in
  Activity. Aider doesn't expose it; LowRouter does.
