Set Up Aider with MonoRouter
Point Aider at MonoRouter with a couple of CLI flags or environment variables and route every edit through your Claude Pro or Max subscription.
What you need
- •A Claude Pro or Max subscription at claude.ai
- •Aider installed —
pip install aider-install && aider-install - •A MonoRouter account — sign up at /signup
- •A MonoRouter API key (
mrk_*) — get one at /keys - •Your Claude subscription connected to MonoRouter — go to /tokens, click
[ + add token ], and run the auto-connect script
Sign up for MonoRouter
Open /signup, enter your email and set a password. Save the six recovery codes — they're your offline fallback if you lose your password; you can also always reset it by email at /forgot-password.
Connect your Claude subscription
From the dashboard, go to /tokens, click [ + add token ], and pick ANTHROPIC. Use the auto-connect tab — it's the fastest.
The modal shows a one-liner like this:
curl -sSL https://api.monorouter.com/connect.sh | bash -s -- mrc_xxxxxxxxxxxx
Paste it into a terminal. The script runs claude setup-token, which opens a browser window for authorization and creates a long-lived token. When the dashboard flips to connected, you're done.
Option 1: OpenAI-compatible flags
Pass the base URL, key, and model directly on the command line:
aider --openai-api-base https://api.monorouter.com/v1 \ --openai-api-key mrk_your_key_here \ --model openai/claude-sonnet-5
Or set the equivalent environment variables once:
export OPENAI_API_BASE="https://api.monorouter.com/v1" export OPENAI_API_KEY="mrk_your_key_here" aider --model openai/claude-sonnet-5
Option 2: Anthropic-native env vars
Aider also has a native Anthropic client. Use these env vars to route that path through MonoRouter and drop the openai/ prefix on the model:
export ANTHROPIC_BASE_URL="https://api.monorouter.com" export ANTHROPIC_API_KEY="mrk_your_key_here" aider --model claude-sonnet-5
Verify it works
Start Aider in a repo and ask it to make a small change, or test the endpoint directly with curl:
curl -X POST https://api.monorouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mrk_your_key_here" \
-d '{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "hi"}]
}'A 200 with a JSON response means you're done. The call also shows up on /dashboard within a second or two.
Choosing a model
Use any of these model IDs (with the openai/ prefix for Option 1, or bare for Option 2):
| Model | ID | Context | Max output |
|---|---|---|---|
| Fable 5 | claude-fable-5 | 1M | 128k |
| Opus 4.8 | claude-opus-4-8 | 1M | 128k |
| Opus 4.7 | claude-opus-4-7 | 1M | 128k |
| Opus 4.6 | claude-opus-4-6 | 1M | 128k |
| Sonnet 5 | claude-sonnet-5 | 1M | 128k |
| Sonnet 4.6 | claude-sonnet-4-6 | 1M | 128k |
| Haiku 4.5 | claude-haiku-4-5-20251001 | 200k | 64k |
Troubleshooting
- •401 Unauthorized — your connected token expired or was revoked. Go to /tokens and reconnect it; the auto-connect script issues a fresh long-lived token.
- •429 Too Many Requests — you've hit your plan's quota. Free accounts get 1,500 lifetime calls, Hobby ($9/month) adds 10,000 calls/month, Pro ($29/month) is unlimited for personal use, and Team ($99/month) pools quota across 5 seats. Check /billing to upgrade.
- •Streaming is fully supported on both options — Aider's live diff output streams normally through MonoRouter.
Pricing
- •1,500 successful calls are free for the lifetime of your account. Failed calls don't count.
- •After that, paid plans start at $9/month (Hobby, 10,000 calls). Pro is $29/month for unlimited personal use; Team is $99/month for 5 pooled seats. See /billing for the payment flow.
FAQ
Should I use the OpenAI-compatible flags or the Anthropic env vars?
Either works. The OpenAI-compatible flags (--openai-api-base / --openai-api-key with an openai/ model prefix) are the most portable across Aider versions. The ANTHROPIC_API_KEY + ANTHROPIC_BASE_URL env vars route through Aider’s native Anthropic client instead, which some users prefer for prompt caching behavior.
Which model name should I pass to --model?
With the OpenAI-compatible path, prefix the model with openai/, e.g. openai/claude-sonnet-5. With the Anthropic-native env vars, use the bare model ID, e.g. claude-sonnet-5.
Does Aider’s streaming output still work?
Yes. Aider streams the model’s response as it edits files, and MonoRouter supports streaming on both the OpenAI-compatible and Anthropic-native paths.
Can I keep my MonoRouter key out of my shell history?
Yes — set OPENAI_API_BASE / OPENAI_API_KEY (or ANTHROPIC_BASE_URL / ANTHROPIC_API_KEY) in your shell profile or a .env file instead of passing --openai-api-key on the command line.
Ready to get started?
Sign up in 30 seconds — no credit card required. 1,500 free API calls included.