Skip to content

Connect Aider to XiuRouter

Start Aider with temporary environment variables and verify code editing before changing persistent settings.

Updated Reviewed
View Markdown

For a first setup, set the Base URL and key in one terminal, then start a new Aider session with openai/MODEL_ID. If you already use Aider, test in a separate terminal without editing your existing .aider.conf.yml.

Choose a setup method

  • First setup: set the connection in the current terminal and start Aider.
  • Existing setup: use a separate test terminal and keep the original configuration.
  • Chat-assisted setup: unavailable; the current Aider session cannot modify its parent process’s environment.

Before you start

  • aider --version returns a version.
  • You have an Aider-specific XiuRouter API key.
  • You have selected a model suited to tools or coding tasks.

Set the connection

In the terminal that will start Aider:

export OPENAI_API_BASE="https://router-api.xiu.ai/v1"
export OPENAI_API_KEY="YOUR_XIUROUTER_API_KEY"

For Windows PowerShell:

$env:OPENAI_API_BASE = "https://router-api.xiu.ai/v1"
$env:OPENAI_API_KEY = "YOUR_XIUROUTER_API_KEY"

These variables apply only to new processes started from that terminal. Start Aider in a test directory:

aider --model openai/YOUR_MODEL_ID

The openai/ prefix selects Aider’s OpenAI-compatible provider; the model sent to XiuRouter is still YOUR_MODEL_ID.

Verify

  1. Start Aider in a disposable test repository.
  2. Ask it to read and summarize one file without changing it.
  3. Request a reversible edit to a test file and inspect the diff.
  4. In XiuRouter’s request inspection view, verify the key, model, /v1/chat/completions endpoint, and successful result.

Aider may not know a custom model’s context window or editing format. Verify actual edits after text works; do not infer these settings from the model name.

Troubleshoot

Symptom Next step
Requests still go to OpenAI Set OPENAI_API_BASE in the same environment that starts Aider
401 Check that OPENAI_API_KEY contains a valid XiuRouter key
Model not found Use openai/YOUR_MODEL_ID and confirm the key can see it in /v1/models
Chat works but editing fails Choose a model with verified tool or code-editing support

Roll back

unset OPENAI_API_BASE
unset OPENAI_API_KEY

In PowerShell, close the test terminal to discard the temporary variables. Restart Aider and confirm the original provider is used. Revoke the test key when it is no longer needed.

Sources and review date

Reviewed on 2026-08-31. This translation preserves that date. Basic setup is complete only after Aider receives a full reply and XiuRouter records the expected model, endpoint, and successful request.

Navigation

Enter keywords to search

↑↓ Move↵ OpenEsc Close