Aider is a pair-programming tool for the terminal that edits files in your git repository. It works with any OpenAI-compatible API, so you can run it on Yunshu Router with the model you choose, billed per token to your prepaid balance.
What you need
- Aider installed (
python -m pip install aider-installthenaider-install). - A Yunshu Router account with credit on the balance.
- An API key from the console. Use a separate key for Aider.
Set it up
-
Create a key in the console (API keys → Create key) and copy it.
-
Set two environment variables. macOS and Linux:
export OPENAI_API_BASE=https://api.yunshurouter.com/v1 export OPENAI_API_KEY=YOUR_YUNSHU_KEYWindows (then open a new terminal):
setx OPENAI_API_BASE https://api.yunshurouter.com/v1 setx OPENAI_API_KEY YOUR_YUNSHU_KEYKeep the
/v1. If you already useOPENAI_API_KEYfor OpenAI, put both lines in a.envfile in the project instead. Aider reads.envfrom your home directory, then the git repo root, then the current directory. Later files win. -
Start Aider with the
openai/prefix in front of our model ID:aider --model openai/deepseek-v4-proThe prefix tells Aider to send the request to the OpenAI-compatible address above. It is not part of our model ID.
-
Optional: tell Aider the model’s limits and prices. Aider warns about models it doesn’t know. Create
.aider.model.metadata.jsonin your home folder or project:{ "openai/deepseek-v4-pro": { "max_input_tokens": 131072, "max_output_tokens": 8192, "input_cost_per_token": 0, "output_cost_per_token": 0, "litellm_provider": "openai", "mode": "chat" } }
Check it works
- In Aider, type:
/ask what does this repository do? - A sensible answer means the key, address and model work.
- Ask for a small change, for example “add a docstring to the main function”. Aider should edit the file and commit it.
- Open Usage in the console: the requests show under the Aider key.
Recommended models
| Model ID (with Aider prefix) | Use it for |
|---|---|
openai/ |
Main model for edits |
openai/ |
--weak-model for commit messages and summaries |
openai/ |
Architect mode, planning changes |
Example with a cheaper model for commit messages:
aider --model openai/deepseek-v4-pro --weak-model openai/glm-5.3
Set a budget on the key
In the console, open API keys, pick the Aider key and set a monthly budget, a model
allow-list and a budget alert. A request that would pass the budget is refused with
402 budget_exceeded.
Known limitations
- Aider’s cost display uses the prices in its metadata file, not our bill.
- Aider picks an edit format per model; unknown models get a default that may not suit them. Try
--edit-format difforwholeif edits fail to apply.
Troubleshooting
| What you see | Likely cause | Fix |
|---|---|---|
401 |
Wrong key, or OpenAI’s key still set | echo $OPENAI_; set it to your Yunshu Router key. |
| Requests go to OpenAI | OPENAI_ not set in this shell |
Export it again or open a new terminal. |
404 on every request |
Base URL without / |
Use https:/. |
404 naming the model |
Missing openai/ prefix, or ID typo |
Use openai/ + the ID from the models page. |
| “Unknown context window” warning | Aider doesn’t know our model | Add .aider.model.metadata.json (step 4), or ignore. |
403 naming the model |
Not on the key’s allow-list | Add it to the key. |
402 |
Budget or balance used up | Raise the budget or top up. |