# Aider

<img
  src="/brand/banner-a-01.webp"
  alt=""
  loading="lazy"
  width="1280"
  height="549"
  className="brand-band"
/>

[Aider](https://aider.chat) is a terminal pair programmer that edits files in
your git repo and commits as it goes. It connects to any OpenAI-compatible
endpoint.

*Setup guide: this config comes from Aider's official documentation and has
not been run end to end against the gateway. Corrections to [support@hyphen-solution.com](mailto:support@hyphen-solution.com).*

## The easy mistake

Aider routes through LiteLLM, which needs to be told what kind of endpoint it
is talking to. That is what the `openai/` prefix on the model name does.

```bash
aider --model openai/minimax-m3     # correct
aider --model minimax-m3            # fails, LiteLLM cannot route it
```

The prefix is stripped before the request, so Hyphen still receives
`minimax-m3`. Also note the env var is **`OPENAI_API_BASE`**, not
`OPENAI_BASE_URL`. Aider does not read the latter.

## 1. Get a key

[app.hyphen-solution.com](https://app.hyphen-solution.com) → sign in → pick a
plan or credit pack → **Dashboard → API Keys**. Copy the `sk-...` key.

## 2. Configure

```bash
export OPENAI_API_BASE="https://api.hyphen-solution.com/v1"
export OPENAI_API_KEY="sk-YOUR_KEY"

aider --model openai/minimax-m3
```

On Windows use `setx` and restart the shell:

```
setx OPENAI_API_BASE https://api.hyphen-solution.com/v1
setx OPENAI_API_KEY sk-YOUR_KEY
```

### As flags

```bash
aider \
  --openai-api-base https://api.hyphen-solution.com/v1 \
  --openai-api-key sk-YOUR_KEY \
  --model openai/minimax-m3
```

### As a config file

`.aider.conf.yml` in your home directory or git root:

```yaml
openai-api-base: https://api.hyphen-solution.com/v1
openai-api-key: sk-YOUR_KEY
model: openai/minimax-m3
weak-model: openai/minimax-m2.5
```

`weak-model` is what Aider uses for commit messages and summarising chat
history. Point it at `minimax-m2.5` so those small jobs finish fast.

### As a `.env` file

Aider reads `.env` with `AIDER_`-prefixed names:

```bash
AIDER_OPENAI_API_BASE=https://api.hyphen-solution.com/v1
AIDER_OPENAI_API_KEY=sk-YOUR_KEY
AIDER_MODEL=openai/minimax-m3
AIDER_WEAK_MODEL=openai/minimax-m2.5
```

Plain `OPENAI_API_BASE` and `OPENAI_API_KEY` also work in `.env`.

## 3. Verify

```bash
cd your-repo
aider --model openai/minimax-m3
```

At the prompt, ask it to reply with a single word. Aider prints the model it is
using on startup, so check that line says `openai/minimax-m3`.

## Telling Aider the context window and cost

Hyphen models are not in LiteLLM's model database, so Aider does not know their
context window or price and will say so. Fix it with a metadata file. Create
`.aider.model.metadata.json` in your home directory or git root:

```json
{
  "openai/minimax-m3": {
    "max_tokens": 32000,
    "max_input_tokens": 200000,
    "max_output_tokens": 32000,
    "input_cost_per_token": 0.0000003,
    "output_cost_per_token": 0.0000012,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/minimax-m2.5": {
    "max_tokens": 32000,
    "max_input_tokens": 200000,
    "max_output_tokens": 32000,
    "input_cost_per_token": 0.0000003,
    "output_cost_per_token": 0.0000012,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/minimax-text-01": {
    "max_tokens": 32000,
    "max_input_tokens": 4000000,
    "max_output_tokens": 32000,
    "input_cost_per_token": 0.0000002,
    "output_cost_per_token": 0.0000011,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}
```

Key each entry by the **fully qualified** name including the `openai/` prefix.
Those costs are the real [rate card](/models), so Aider's running total will
match your console. Point at a file elsewhere with
`--model-metadata-file path/to/file.json`.

Aider only *reports* token limits, it does not enforce them, so this file is
optional. Without it you lose the cost display and get a warning on startup.

## Which model

- **`openai/minimax-m3`** as the main model. Aider does whole-file and diff
  edits that reward the flagship.
- **`openai/minimax-m2.5`** as the `weak-model` for commit messages.
- **`openai/minimax-text-01`** if you use `/add` on a very large set of files.

## Troubleshooting

- **"LLM Provider NOT provided"** or a routing error. You left off the
  `openai/` prefix.
- **404**. `OPENAI_API_BASE` is missing the `/v1` suffix, or you set
  `OPENAI_BASE_URL` instead, which Aider ignores.
- **`401`**. Wrong key.
- **Warning about unknown context window**. Add the metadata file above.
- **Empty or truncated edits**. The M-series reason before answering. See
  [Choosing a model](/choosing-a-model#the-max_tokens-gotcha).
- **`429`**. Monthly budget spent. See [Rate limits & caps](/rate-limits).
- **Flags changed?** Check
  [Aider's OpenAI-compatible docs](https://aider.chat/docs/llms/openai-compat.html)
  and the [options reference](https://aider.chat/docs/config/options.html).

## Related

- [Choosing a model](/choosing-a-model): which model for which job.
- [Other OpenAI-compatible clients](/agents/other-clients): opencode, Cursor, Cline, Continue.
