Aider
AI pair programming in your terminal, billed through RouterPlex.
On this page
Set it up with your coding agent #
Paste your key into the prompt's key field, then copy the prompt into Claude Code, Codex, Cursor, or any coding agent. It configures the tool and keeps testing until a real request goes through RouterPlex, fixing environment problems along the way. Prefer to do it by hand? Follow the manual setup below; your key fills those commands too.
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up Aider on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from Aider succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/aiderStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure Aider:- Run aider --version. If Aider is missing, install it (macOS/Linux: curl -LsSf https://aider.chat/install.sh | sh; Windows PowerShell: powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex").- Put these in my user-level ~/.aider.conf.yml (Windows: %USERPROFILE%\.aider.conf.yml), keeping my other settings:openai-api-base: https://api.routerplex.com/v1openai-api-key: <key>model: openai/claude-sonnet-4-6weak-model: openai/claude-haiku-4-5- Do not set OPENAI_API_KEY or OPENAI_API_BASE permanently: other OpenAI tools on this machine would start using RouterPlex too.Step 3. Test Aider itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:From an empty temporary folder: aider --chat-mode ask --no-git --message "Reply with exactly: RouterPlex connected."Warnings about unknown context size or pricing for the model are expected.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is Aider's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where Aider starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- Aider is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach Aider reliably and Aider accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Manual setup #
Aider selects RouterPlex's Chat Completions format with an openai/ model prefix. Follow the installer for macOS/Linux or Windows PowerShell, then use a dedicated key.
1. Install #
macOS/Linux:
curl -LsSf https://aider.chat/install.sh | sh
Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
These official installers create an isolated Python environment. Reopen your terminal and run aider --version. Have Git installed before starting a coding session.
2. Set your endpoint and key #
macOS / Linux
export OPENAI_API_BASE='https://api.routerplex.com/v1'export OPENAI_API_KEY='YOUR_ROUTERPLEX_API_KEY'aider --model openai/claude-sonnet-4-6
Windows PowerShell
$env:OPENAI_API_BASE = 'https://api.routerplex.com/v1'$env:OPENAI_API_KEY = 'YOUR_ROUTERPLEX_API_KEY'aider --model openai/claude-sonnet-4-6
Replace the key placeholder locally. OPENAI_API_BASE is Aider's variable name; the SDK-only OPENAI_BASE_URL name is not a replacement for it. The part after openai/ must exactly match the model catalog.
3. Verify before editing #
Start in a disposable repository. Use /ask Reply with exactly: RouterPlex connected. for a chat-only test, then confirm the request in Usage. Try an edit on a small test file before moving to a larger project.
Custom model IDs may produce unknown-context or pricing warnings because Aider's built-in metadata does not know the route. Configure model settings if needed; do not treat a local cost estimate as the RouterPlex bill.
Optional persistent model settings #
Keep the key in your environment. Put only non-secret defaults in ~/.aider.conf.yml (Windows: %USERPROFILE%\.aider.conf.yml):
openai-api-base: https://api.routerplex.com/v1model: openai/claude-sonnet-4-6weak-model: openai/claude-haiku-4-5
Your key must allow both the main and weak models. A new terminal needs the key variable set again. See environment setup and key budgets.
A longer walkthrough of the same OpenAI-compatible setup is in Aider OpenAI-compatible API.
Official references: Aider installation, OpenAI-compatible endpoints.