Skip to content

Integrations / Aider

Use Aider with any model

Run Aider on DeepSeek, GLM and Kimi models with a Yunshu Router key. Two environment variables, the openai/ prefix, checks and fixes.

Get an API key

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-install then aider-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

  1. Create a key in the console (API keys → Create key) and copy it.

  2. Set two environment variables. macOS and Linux:

    export OPENAI_API_BASE=https://api.yunshurouter.com/v1
    export OPENAI_API_KEY=YOUR_YUNSHU_KEY

    Windows (then open a new terminal):

    setx OPENAI_API_BASE https://api.yunshurouter.com/v1
    setx OPENAI_API_KEY YOUR_YUNSHU_KEY

    Keep the /v1. If you already use OPENAI_API_KEY for OpenAI, put both lines in a .env file in the project instead. Aider reads .env from your home directory, then the git repo root, then the current directory. Later files win.

  3. Start Aider with the openai/ prefix in front of our model ID:

    aider --model openai/deepseek-v4-pro

    The prefix tells Aider to send the request to the OpenAI-compatible address above. It is not part of our model ID.

  4. Optional: tell Aider the model’s limits and prices. Aider warns about models it doesn’t know. Create .aider.model.metadata.json in 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

  1. In Aider, type: /ask what does this repository do?
  2. A sensible answer means the key, address and model work.
  3. Ask for a small change, for example “add a docstring to the main function”. Aider should edit the file and commit it.
  4. Open Usage in the console: the requests show under the Aider key.
Model ID (with Aider prefix) Use it for
openai/deepseek-v4-pro Main model for edits
openai/glm-5.3 --weak-model for commit messages and summaries
openai/kimi-k3 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 diff or whole if edits fail to apply.

Troubleshooting

What you see Likely cause Fix
401 Wrong key, or OpenAI’s key still set echo $OPENAI_API_KEY; set it to your Yunshu Router key.
Requests go to OpenAI OPENAI_API_BASE not set in this shell Export it again or open a new terminal.
404 on every request Base URL without /v1 Use https://api.yunshurouter.com/v1.
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.

Questions

Why the openai/ prefix?

Aider routes the request by prefix. openai/ sends it to the address in OPENAI_API_BASE, which is us.

Can I use Claude models in Aider through Yunshu Router?

Not yet. Claude models can’t be called today. Use the DeepSeek, GLM and Kimi models on the models page.

Will this break my normal OpenAI setup?

Only in shells where you set the two variables. Use a project .env file to keep them separate.