Update, Nov 9, 2026: CodeRouter's pricing has changed since this post. It is now pay as you go from a prepaid balance with no monthly fee, with smart routing or Direct mode (you name the exact model) on the same account, or Team per developer. The monthly plans and the separate Direct plan described below are no longer sold; accounts already on them keep their terms. The rest of the post is as published. Current terms: pricing.
Update, Nov 9, 2026: OpenRouter has since launched Auto Code (openrouter/auto-code), a router for coding agents that picks a model and reasoning effort for each request at no extra fee. We corrected the OpenRouter entries this made wrong (how the model is chosen, coding-specific routing, the "not a coding-aware router" bullet and the setup line); the rest of the guide is as published.
Updated 2026-11-04: new section on AgentRouter (agentrouter.org), checked on its own site and docs today. OpenRouter, LiteLLM, Portkey and RouteLLM re-checked on their official pages; the OpenRouter BYOK entry is corrected (OpenRouter does accept your own provider keys), and an unsourced monthly-cost table is replaced with our own team's measured routed cost, next to the same requests priced at Sonnet and Opus list prices (that comparison was removed on 2026-11-07; see the correction below). CodeRouter is our product, and TokenWatt, which ran the benchmark quoted below, is a measurement project from the same team.
TL;DR — "AgentRouter" means two things in searches: AgentRouter at agentrouter.org, a free community relay (details below) that hands out credits for Claude Code, Codex and other coding tools, and agent routers in general — middleware that sends each request from your coding agent to a model. AgentRouter suits trying tools on free credits if you can live with models coming and going; its own notice says it is not meant to be a stable API service. For steady work, pick by need: OpenRouter for one API to many models, LiteLLM to self-host, Portkey for gateway observability, and CodeRouter for coding-specific routing that starts each task on the cheapest capable model and escalates only on failure. In TokenWatt's 176-task coding benchmark, CodeRouter solved 96–100% of tasks for 56–70% less than sending every request to Opus, across runs (methodology).
What is AgentRouter (agentrouter.org)?
Checked 2026-11-04 on agentrouter.org (site notices), its setup docs and its terms of use. Quotes from Chinese-language notices are our translation. Things we could not confirm are left out.
- What it is. A free relay for AI coding tools. Its docs call it an "AI Coding 公益站" — a free, community-run AI coding site — and its terms say it aims to provide "a sustainable, free API service for genuine developers". You sign up, receive credits, create a token in its console and point your tool at
https://agentrouter.org. - Tools. The docs have setup guides for Claude Code, Codex, Cline, Roo Code, Kilo Code, Qwen Code, OpenCode, OpenClaw, Hermes Agent, Crush, Trae and others. A 2026-09-18 notice lists the supported clients (Cursor and GitHub Copilot among them) and says accounts used for non-coding work or from unsupported clients are moved to a "probation" group charged at double the usual rate multiplier.
- Models. On 2026-11-04 its Claude Code guide listed
claude-opus-5,claude-opus-4-8,gpt-5.6-sol,gpt-6-astra,glm-5.3anddeepseek-v4-flash— AgentRouter's own model names — and says the list changes with the resources it has. - Availability. Since a 2026-08-28 notice, Claude and GPT models are released in daily batches; when a batch is used up, requests fail with
402 Budget pool quota has been exhausteduntil the next one. A 2026-10-19 notice put Claude Opus 5.5 on its own daily quota (released at 01:00 UTC, first come, first served), and a 2026-10-24 notice says it is temporarily unavailable. - In its own words. A 2025-10-18 notice says the site's goal is to serve developers "rather than to provide a stable LLM API service", and suggests going to OpenRouter or the model providers directly if that is what you need.
- Rules. The terms forbid reselling or sharing accounts and credits, bulk sign-ups and distillation, say that heavy non-coding use such as role-play chat will be restricted, and say quotas, model availability and rate limits are adjusted per account by criteria it does not publish.
- Where the capacity comes from. The pages we read don't say. That question matters for any router; our agent router safety checklist covers what to ask.
Who AgentRouter suits: an individual developer trying Claude Code or Codex on free credits for side projects, who is fine with quotas running out and models disappearing for days.
Who it doesn't suit: teams and paid work that need the same model to be there tomorrow, invoices, per-developer budgets or a written data policy. That is what the paid alternatives below are for.
AgentRouter vs CodeRouter at a glance
| AgentRouter (agentrouter.org) | CodeRouter | |
|---|---|---|
| What it is | Free community relay for coding tools | Paid router built for coding agents |
| Price | Free credits; quotas vary by account and by day | Free trial ($5 of usage over 7 days, no card); Starter $19, Solo $29, Pro $99 a month with $15 / $25 / $85 of usage included; Team $19 per developer a month plus usage at list price +5% |
| Choosing a model | You pick from the models it has that day | Routing picks a tier per request — Claude Haiku 5.5, Kimi K2.6, Claude Sonnet 5.5, Claude Opus 5.5 (the Direct plan lets you pick the exact model) |
| When a model is unavailable | 402 until the next daily batch, or switch models yourself |
Falls back to another model on rate limits and provider errors |
| Team controls | None documented | One key per engineer; budgets per member, project and company; email at 80%; downgrade or pause at 100% (Team) |
| Data | Not stated in the pages we read | Stores a trimmed excerpt of each request for up to 180 days to improve routing; Team admins can turn that off; never sold |
What is an agent router and why do you need one?
An agent router is middleware that intercepts API calls from your AI coding agent (Claude Code, Cursor, Aider, Continue, custom agents) and sends each one to a model based on rules or a judgment about the request.
The problem it solves
Modern AI coding workflows make hundreds of LLM calls per session:
- Planning calls — "Design the architecture for this feature" → needs frontier reasoning (Claude Opus, GPT-5.5)
- Implementation calls — "Write this function based on the plan" → a mid-tier model is usually enough
- Test generation — "Write unit tests for this module" → cheap models often handle it
- Documentation — "Add docstrings to these functions" → the cheapest model that writes clear English
Without a router, every call goes to the same model — usually the most expensive one. That's like taking a taxi to the mailbox because you also take taxis to the airport.
What a router does
- Reads each request — task type, difficulty, context size
- Picks a model — ideally the cheapest one that can do the job
- Handles fallbacks — if a provider is down or rate-limited, retries with an alternative
- Gives you one API — one endpoint and one format for many models and providers
Agent router alternatives compared (2026)
Prices and repository activity checked 2026-11-04 on openrouter.ai/pricing, OpenRouter's BYOK docs, portkey.ai/pricing, LiteLLM's docs and the RouteLLM repository.
| Feature | OpenRouter | LiteLLM | RouteLLM | Portkey | CodeRouter |
|---|---|---|---|---|---|
| Type | Hosted gateway | Open-source gateway and SDK you host | Open-source research router | Hosted gateway (open-source core) | Hosted router for coding agents |
| How the model is chosen | You pick it; or, at no extra fee, Auto Router (openrouter/auto) or Auto Code for coding agents (openrouter/auto-code, since Nov 2026) |
Rules you configure | Trained strong/weak classifier | Rules, fallbacks, load balancing | Judgment model + cost rules, four tiers |
| Coding-specific routing | Yes, Auto Code (since Nov 2026) | No | No | No | Yes |
| Your own provider keys (BYOK) | Yes: $25,000 a month of list-price usage with no fee, then 5% | Yes — you bring them | Yes | Yes | Only as an opt-in fallback on paid plans |
| Pricing | 5.5% fee on credit purchases (8% on Business), no per-token markup | Free to self-host | Free to self-host | Free for 10k logged requests a month; Production $49 a month for 100k | Plans include usage at list price, +5% past it; Team: $19 per developer plus usage at list +5%; Direct: list +5% |
| Fallbacks | Model and provider fallbacks | Configurable | None | Configurable | Automatic |
| Best for | One API to many models | Full control on your own infrastructure | Research | Observability across apps | Cutting coding-agent cost |
OpenRouter
The most popular multi-model gateway. You send requests to OpenRouter's API, choose a model, and it proxies to a provider.
- Coding-aware routing since November 2026 — Auto Code (
openrouter/auto-code) is tuned for coding agents: a decision model rates each request (such as task type, whether the task just changed and how hard it is) and picks a model and reasoning effort, with no extra fee. You can still pick the model yourself or use the general Auto Router (openrouter/auto). (Corrected Nov 9, 2026; this bullet said OpenRouter was not a coding-aware router.) - Fees — 5.5% on credit purchases (8% on Business), with inference at the provider's list price and no per-token markup.
- BYOK — your own provider keys work too: the first $25,000 of list-price usage a month carries no fee, then 5%.
Best for: developers who want many models through one API without managing provider accounts. Our detailed comparison: CodeRouter vs OpenRouter.
LiteLLM
An open-source gateway and Python SDK that gives one OpenAI-compatible interface to 100+ providers. You host it and bring your own API keys.
- Maximum flexibility — routing, fallbacks and budgets are yours to configure
- No markup — you pay providers directly
- Engineering effort — you run, upgrade and tune it yourself
- No built-in task judgment — it routes on the rules you write
Best for: teams with engineering time that want full control over their LLM infrastructure.
RouteLLM — unmaintained since 2024-08 (checked 2026-11-04)
A research project from LMSYS (UC Berkeley) that trains classifiers to choose between a strong and a weak model. The repository's last commit is from 2024-08-10.
- Learned routing — trained on preference data to predict when the cheaper model is enough
- Two models only — strong or weak, no multi-tier pool
- Research code — limited error handling and no fallbacks
Best for: researchers exploring routing strategies; not a production choice for coding workflows.
Portkey
An AI gateway with observability, caching and routing rules:
- Monitoring and logging — every request, token count and latency
- Fallbacks, retries and load balancing — across providers, models and keys
- Pricing by logged requests — free for 10k a month; Production is $49 a month for 100k, then $9 per additional 100k
- Not coding-aware — a general-purpose gateway
Best for: teams that want one gateway with observability across many AI apps.
CodeRouter
CodeRouter is built for AI coding agents. It works on the observation that most coding requests don't need the most expensive model:
- Judgment-model routing — a small judgment model (Jev, from TypeSafe) reads a compact excerpt of each request — the latest message and the latest tool output — and judges the coding phase, how hard the task is and whether the last turn failed; code then picks a tier. Each task starts on the cheapest tier that can handle it — Claude Haiku 5.5 (or DeepSeek Chat), Kimi K2.6, Claude Sonnet 5.5, Claude Opus 5.5 — and moves up one tier only when tests or errors show a failure. After three clean turns it returns to the starting tier.
- Cache-aware sessions — a session stays on one model so the provider's prompt cache stays warm. With long contexts (30k tokens or more) it needs two failures before switching, because a switch throws the cache away.
- Fallbacks — if a provider rate-limits or errors, the request falls back to another model.
- One endpoint — set
model: auto(Claude Code:ANTHROPIC_MODEL=auto) and routing does the rest. Response headers show which model and tier served each request and what it cost. - Team budgets — on the Team plan, each engineer gets their own key, and admins set budgets per member, per project and for the company: an email at 80%, then downgrade to cheaper models or pause at 100%.
Best for: developers and teams who want to cut coding-agent costs without changing their workflow. In TokenWatt's 176-task benchmark (same team as CodeRouter), routing solved 96–100% of tasks for 56–70% less than sending every request to Opus, across runs. For Claude Code specifically, see Claude Code Router: open-source vs hosted.
How agent routing works
Basic routing (most tools)
Your Agent → Router → [You pick: Claude/GPT/etc] → Provider
You choose the model for each request. Better than no router (you get fallbacks and one API), but you're still doing the thinking.
Phase-aware routing (CodeRouter)
Your Agent → CodeRouter → [Judge phase, difficulty, last-turn failure] → Cheapest tier that can handle it
CodeRouter (routing v3) judges each request and picks where it starts:
| Situation | What it looks like | Starts on | Why |
|---|---|---|---|
| Hard planning | "Design the auth system architecture" | Claude Opus 5.5 | Needs deep reasoning |
| Hard task / moderately hard planning | "Refactor the session layer without breaking callers" | Claude Sonnet 5.5 | Strong coding, lower price |
| Typical implementation, tests, debugging | "Implement the login endpoint per the plan" | Kimi K2.6 | Solid coding at a fraction of the price |
| Small edits, docs, easy tasks | "Add JSDoc to these functions" | Claude Haiku 5.5 (or DeepSeek Chat) | Cheapest tier |
| The last turn failed | "Fix the failing test on line 42" after a red test run | One tier up | Escalate only on evidence |
Frontier models where the task needs them, and a much lower bill overall: in TokenWatt's benchmark, 96–100% of tasks solved for 56–70% less than all-Opus, across runs.
Agent router best practices
1. Start with logging, then optimize
Before you configure routing, log a week of model usage. You'll likely find that much of the spend goes to tasks that don't need frontier models.
2. Set quality floors, not ceilings
Don't send everything to the cheapest model. Keep planning and architecture on frontier models — a bad architecture decision costs far more than the API savings.
3. Use fallback chains
Provider outages happen. Give every route at least one fallback model from a different provider, so one outage doesn't stop your agent.
4. Watch the routing decisions
Track what share of requests goes to each tier. If 90% go to frontier models, routing isn't doing much; if nearly everything goes to the cheapest tier and failures rise, it's too aggressive.
5. Review monthly
Model prices and capabilities change often. Re-check your routing set-up monthly, after new model releases and price changes.
Real costs from our own numbers
Two measurements, both from TokenWatt and CodeRouter's own team rather than customers:
- Benchmark: on 176 single-file Python tasks, routing solved 96–100% of tasks for 56–70% less than sending every request to Opus, across runs (details).
- Real usage: CodeRouter's own engineers (one key each, May–September 2026) routed about $86 of model cost in a typical month of 20 working days, and about $260 in a heavy month, at list prices. That is what was spent, not a comparison with another setup: a different model takes a different number of steps to finish the same task, so models are compared on fixed tasks (the benchmark above), not by repricing this traffic. Your usage will differ.
Corrected 2026-11-07: the monthly figures are at list prices. The earlier ones (~$87 and ~$340) were CodeRouter's recorded costs, which priced Claude Opus 4.7 at 3× its list price until October 29, 2026. We also removed a table that priced the same requests at Claude Sonnet 5.5 and Opus 5.5 list prices.
Getting started
With CodeRouter (built for coding)
- Sign up at coderouter.io — the free trial includes $5 of usage over 7 days, no credit card
- Create a CodeRouter API key (it starts with
cr_). CodeRouter uses its own provider keys, so you don't need yours - Point your coding agent at CodeRouter. For Claude Code:
export ANTHROPIC_BASE_URL=https://www.coderouter.io
export ANTHROPIC_AUTH_TOKEN=cr_... # your CodeRouter key — not ANTHROPIC_API_KEY
export ANTHROPIC_MODEL=auto
claude
Cursor, Aider, Cline, Continue.dev, OpenClaw and the OpenAI SDK use the OpenAI-compatible base URL https://www.coderouter.io/api/v1 (integration docs). Plans: /pricing.
With LiteLLM (self-hosted)
pip install 'litellm[proxy]'
litellm --model openai/<your-model> --api_base <your-api-base>
Then configure routing, fallbacks and budgets in its config. More effort, maximum control.
With OpenRouter (one API, many models)
Use https://openrouter.ai/api/v1 as the base URL and OpenRouter's provider-prefixed model IDs (for example anthropic/...), or openrouter/auto to let its Auto Router choose (openrouter/auto-code for its router tuned for coding agents).
Frequently asked questions
What is AgentRouter?
AgentRouter (agentrouter.org) is a free, community-run relay that gives developers credits to use Claude Code, Codex and other coding tools through its endpoint. Its terms describe it as "a sustainable, free API service for genuine developers"; quotas and available models change with its resources (checked 2026-11-04). The term "agent router" is also used for routing middleware in general — the rest of this guide compares those.
Is AgentRouter free?
Yes, it hands out free credits. Since 2026-08-28, Claude and GPT models have been released in daily batches; when a batch is used up, requests return 402 Budget pool quota has been exhausted until the next one, and its terms say quotas and rate limits are adjusted per account.
What is the best AgentRouter alternative in 2026?
It depends on what you need. For AI coding agents, CodeRouter routes each request to the cheapest capable tier (TokenWatt 176-task benchmark, same team as CodeRouter: 96–100% solved for 56–70% less than all-Opus, across runs). For one API to many models, OpenRouter. For self-hosting, LiteLLM. For gateway observability, Portkey.
How does agent routing reduce costs?
By matching each request to the cheapest model that can handle it. In a typical coding workflow, many requests (tests, docs, small edits) don't need a frontier model; sending those to cheaper models cuts the bill while the hard tasks still get frontier reasoning.
Can I use an agent router with Cursor?
Usually, yes. Most routers expose an OpenAI-compatible endpoint: in Cursor's settings, override the OpenAI base URL with the router's endpoint and use the model name the router expects (auto for CodeRouter).
Is agent routing safe? Does the router see my code?
It depends on the router. Hosted routers (OpenRouter, Portkey, AgentRouter, CodeRouter) proxy your requests, so your prompts pass through their servers. Self-hosted options (LiteLLM) keep everything on your infrastructure. CodeRouter routes with its own provider keys (your own keys are only an opt-in fallback once a paid plan's usage runs out). To improve routing, CodeRouter stores an excerpt of each request (the latest message and tool output, trimmed) and a short response summary for up to 180 days — Team admins can turn content storage off — and the excerpt is sent to TypeSafe, which runs the routing judgment model (TypeSafe states it does not train on customer data). Data is never sold. For maximum privacy, self-host LiteLLM and write your own routing rules. More in our agent router safety checklist.
Earlier updates: on 2026-09-21 we noted that RouteLLM had had no commits since 2024-08-10, and that OpenRouter, LiteLLM and Portkey were live with reachable pricing pages.