All guides

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:

bash
curl -sSL https://api.monorouter.dev/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:

bash
aider --openai-api-base https://api.monorouter.dev/v1 \
  --openai-api-key mrk_your_key_here \
  --model openai/claude-sonnet-5

Or set the equivalent environment variables once:

bash
export OPENAI_API_BASE="https://api.monorouter.dev/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:

bash
export ANTHROPIC_BASE_URL="https://api.monorouter.dev"
export ANTHROPIC_API_KEY="mrk_your_key_here"

aider --model claude-sonnet-5
Both options hit the same MonoRouter account and the same connected Claude subscription — pick whichever integrates better with your existing shell setup.

Verify it works

Start Aider in a repo and ask it to make a small change, or test the endpoint directly with curl:

bash
curl -X POST https://api.monorouter.dev/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):

ModelIDContextMax output
Fable 5claude-fable-51M128k
Opus 4.8claude-opus-4-81M128k
Opus 4.7claude-opus-4-71M128k
Opus 4.6claude-opus-4-61M128k
Sonnet 5claude-sonnet-51M128k
Sonnet 4.6claude-sonnet-4-61M128k
Haiku 4.5claude-haiku-4-5-20251001200k64k

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.

guide: set up Aider with MonoRouter · monorouter