# Aider (/docs/guides/aider)

Run the Aider coding assistant on cheapaimodel models through the OpenAI-compatible API.



Aider connects to OpenAI-compatible APIs through its `openai/` model prefix: point the base URL and key at cheapaimodel and put `openai/` in front of the model ID.

|          | Aider setting                            | Value                                                                             |
| -------- | ---------------------------------------- | --------------------------------------------------------------------------------- |
| Base URL | `OPENAI_API_BASE` or `--openai-api-base` | `https://api.cheapaimodel.ai/v1`                                                  |
| API key  | `OPENAI_API_KEY` or `--openai-api-key`   | Your key from the console's [API Keys](https://console.cheapaimodel.ai/keys) page |
| Model ID | `--model`                                | `openai/glm-5.3`, or `openai/` plus any ID from the [catalog](/models)            |

## Set it up [#set-it-up]

```bash title="Terminal"
python -m pip install aider-install
aider-install
```

Then, in your project:

```bash title="Terminal"
export OPENAI_API_BASE="https://api.cheapaimodel.ai/v1"
export OPENAI_API_KEY="$CHEAPAIMODEL_API_KEY"
aider --model openai/glm-5.3
```

Aider strips the prefix and requests `glm-5.3` from `/v1/chat/completions`.

To keep the settings without exporting `OPENAI_*` variables for every tool, put them in Aider's config file instead:

```yaml title="~/.aider.conf.yml"
model: openai/glm-5.3
openai-api-base: https://api.cheapaimodel.ai/v1
openai-api-key: sk-...
```

Aider also reads `.aider.conf.yml` from the root of your git repo. Keep files that contain your key out of version control.

## The model warning [#the-model-warning]

On start, Aider prints `Unknown context window size and costs, using sane defaults` for models it has no metadata for, and may suggest similar names such as `zai/glm-5.3`. Keep `openai/glm-5.3`: the suggested names call other providers directly, not cheapaimodel. Aider's docs say the warning is safe to ignore, since Aider does not enforce token limits.

To silence it, pass `--no-show-model-warnings`, or describe the model in `.aider.model.metadata.json` in your home directory:

```json title="~/.aider.model.metadata.json"
{
  "openai/glm-5.3": {
    "max_input_tokens": CONTEXT_LENGTH,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}
```

Replace `CONTEXT_LENGTH` with the context length on the model's page, for example [glm-5.3](/models/glm-5.3). Aider does not know cheapaimodel prices; see your spend on the console's [Activity](https://console.cheapaimodel.ai/activity) page.

## Common mistakes [#common-mistakes]

* **`litellm.BadRequestError: LLM Provider NOT provided`.** The model ID has no `openai/` prefix. Use `--model openai/glm-5.3`.
* **Aider starts with `gpt-4o` and every request fails.** Without `--model` (or `model:` in the config file), Aider sees `OPENAI_API_KEY` and picks a default OpenAI model, such as `gpt-4o` with `gpt-4o-mini` as the weak model. We don't serve those IDs. Always name the model.
* **`--weak-model` or `--editor-model` requests fail.** They follow the same rule as `--model`: prefix them with `openai/` and use catalog IDs, for example `--weak-model openai/glm-5.3-flash`. If you set neither, Aider uses the main model for both.
* **"The API provider's servers are down or overloaded", with retries.** Aider reports every `503` this way. If it fails from the first request, check the model ID: an ID we don't serve returns `503` with `model_not_found`. Otherwise see [Errors](/docs/concepts/errors).
* **`fault filter abort` or `Invalid URL (POST /v1/chat/completions/chat/completions)`.** Both are `404`s from a wrong base URL: the first means `/v1` is missing, the second that the base URL includes the endpoint path. Set exactly `https://api.cheapaimodel.ai/v1`.
