Run Aider with relay.fast models
Aider is an open-source pair-programming tool for the terminal. It connects to any OpenAI-compatible API, so relay.fast models work after you set two environment variables and prefix the model ID with openai/.
Install and connect
python -m pip install aider-install
aider-install# macOS and Linux
export OPENAI_API_BASE=https://relay.fast/v1
export OPENAI_API_KEY=sk-your-api-key
# Windows (PowerShell), then open a new terminal
setx OPENAI_API_BASE https://relay.fast/v1
setx OPENAI_API_KEY sk-your-api-keyaider --model openai/claude-sonnet-5-5The openai/ prefix tells Aider to send requests to the OpenAI-compatible base URL. Keep the rest of the ID exactly as the catalog lists it. There is no installer script for Aider; these steps are the whole setup.
Context window and cost display
Aider does not know relay.fast model IDs, so it warns that the context window and costs are unknown and uses defaults. A .aider.model.metadata.json file sets them; an example built from current prices is below. The costs only change what Aider displays; the charge is what relay.fast records for the request.
Main and weak models
Aider uses a weak model for commit messages and chat summaries. Give it a cheaper model to save tokens:
aider --model openai/claude-sonnet-5-5 --weak-model openai/glm-5.3
Troubleshooting
- 401 or invalid key: the key is wrong, revoked, or pasted with spaces. Create a new key and paste it again.
- 404 or model not found: the base URL must end with
/v1and the model ID must match the catalog exactly. - Context length errors: the task is larger than the model's context window. Start a new task or pick a model with a larger window.
Example metadata file
Values come from the live catalog, . Save the file as .aider.model.metadata.json in your home directory or the repository root.
{
"openai/claude-sonnet-5-5": {
"max_input_tokens": 1000000,
"input_cost_per_token": 2.38095e-07,
"output_cost_per_token": 1.19048e-06,
"litellm_provider": "openai",
"mode": "chat"
}
}
Current prices of models for coding agents
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | $0.238 / $1.19 (−88%) | $0.0238 | 1M |
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | $0.111 / $0.556 (−97%) | $0.00556 | 1M |
| GPT-6.1 Sol requests above 272K input tokens cost more | gpt-6.1-sol | $2 / $10 | $0.03 / $0.15 (−98%) | $0.0015 | 1.05M |
| GLM-5.3 | glm-5.3 | $1.4 / $4.4 | $0.035 / $0.11 (−97%) | $0.0065 | 1M |
| Kimi K3 | kimi-k3 | $3 / $15 | $0.15 / $0.75 (−95%) | $0.015 | 1.05M |
| DeepSeek V4.1 Flash price depends on the time of day; the peak-hours price is shown | deepseek-v4.1-flash | $0.3 / $1.2 | $0.03 / $0.12 (−90%) | $0.0006 | 1M |
Frequently asked questions
Why does Aider need the openai/ prefix?
Aider uses LiteLLM model names. The openai/ prefix sends the model to the OpenAI-compatible endpoint set in OPENAI_API_BASE.
Can I use Claude models in Aider?
Yes. Use openai/ plus the Claude model ID, for example openai/claude-sonnet-5-5.
Does the metadata file change my bill?
No. It only sets the context window and the cost Aider shows.