Aider: the openai/ prefix and model settings files
Run Aider against uttapen: OPENAI_API_BASE and OPENAI_API_KEY, the openai/ model prefix, an output ceiling in the settings file, and a cheap weak model.
Updated: 22 Sep 2026
Aider is a terminal pair programmer that works directly on your git repo. Because it goes through LiteLLM, a custom endpoint needs the openai/ prefix in front of the model name. This page was checked against the docs for version 0.86.
Connecting
export OPENAI_API_BASE="https://api.uttapen.ir/v1"
export OPENAI_API_KEY="sk-up-..."
aider --model openai/anthropic/claude-sonnet-5
The openai/ prefix tells Aider which protocol to speak; the rest of the string stays exactly as our model id, because only the first / is split off. So anthropic/claude-sonnet-5 becomes openai/anthropic/claude-sonnet-5, and openai/gpt-5-mini becomes openai/openai/gpt-5-mini — yes, openai twice.
Instead of environment variables you can keep it all in .aider.conf.yml, in your home directory or the repo root:
openai-api-base: https://api.uttapen.ir/v1
model: openai/anthropic/claude-sonnet-5
weak-model: openai/openai/gpt-5-nano
edit-format: diff
Keep the key out of that file; pass OPENAI_API_KEY through the environment.
Output ceiling and model metadata
Aider sends no max_tokens of its own. On our side that means the hold is based on a default estimate, and if the model writes a long answer the real amount is still deducted in full, so the balance can briefly go negative (pricing). Set the ceiling in .aider.model.settings.yml:
- name: openai/anthropic/claude-sonnet-5
edit_format: diff
use_repo_map: true
extra_params:
max_tokens: 8192
And so Aider knows the context size (and stops warning about an unknown context window), add .aider.model.metadata.json next to it:
{
"openai/anthropic/claude-sonnet-5": {
"max_input_tokens": 200000,
"max_output_tokens": 8192,
"input_cost_per_token": 0,
"output_cost_per_token": 0,
"litellm_provider": "openai",
"mode": "chat"
}
}
Both files are read from your home directory, the repo root or the current folder. Each key must be the full Aider model name, prefix included; matching is exact. The cost fields are zero here so you don't get a misleading dollar estimate — the real toman figure is in Dashboard → Usage.
Set edit_format: diff and use_repo_map: true too. For names it doesn't recognise, Aider falls back to rewriting whole files with no repo map, which is both weaker and more expensive. If a model rejects temperature, add use_temperature: false to the same entry.
A weak model for small jobs
Aider hands commit messages and chat-history summaries to the weak model, and reuses the main model when you don't set one. Give it something cheap:
aider --model openai/anthropic/claude-sonnet-5 \
--weak-model openai/openai/gpt-5-nano
For cheaper everyday work, qwen/qwen3-coder and deepseek/deepseek-v3.2 make good main models.
Checking that it works
aider --model openai/openai/gpt-5-nano --message "hello" --no-auto-commits
If you get an answer, the same request should appear in Dashboard → Usage.
Troubleshooting
| Error | Cause in Aider | Fix |
|---|---|---|
401 invalid_api_key | OPENAI_API_KEY isn't in the environment, or the key is old | Export it in the same terminal |
404 model_not_found | Missing openai/ prefix, or a wrong id | Build the name as openai/ plus an id from /en/models (the 404 also lists the closest ids it guessed, in uttapen.suggestions) |
400 invalid_request about temperature | The model doesn't accept that parameter | Add use_temperature: false to the model settings |
402 insufficient_balance | Balance below the required hold | Top up, and lower max_tokens in extra_params |
429 | The key's rate or monthly limit (rate limits) | Wait, or raise the limit |
| Constant history summarising | No metadata, so Aider assumed a tiny history budget | Create .aider.model.metadata.json |
If your available balance doesn't cover the whole max_tokens, uttapen lowers the output ceiling to fit it (floor 1,024 tokens) and returns the granted value in the X-Uttapen-Max-Tokens header. The diff can then arrive truncated and Aider won't be able to apply it; topping up fixes that. 402 is reserved for the case where even the floor doesn't fit.
Other tools are in integrations; error codes are in errors.
Sign up with a phone number, top up your wallet from 100,000 toman and create a key. Free models work without a top-up — up to 50 requests a day. Create an API key →