context-aware router · optimizes every run

Stop tokenmaxxing your agentic loops.

The self-improving LLM router that optimizes your agentic workflows with every run — works with any harness, any model, any loop.

Quickstart
optimize my coding agent run — cut cost, keep quality
bitrouter · multiplexer7 agents · 5 loops
agents · 7
bitrouter
optimizer · router
claude-code
acp · claude-opus-4.8 $0.43
codex
mcp · openai/gpt-5 $0.28
opencode
openai · qwen/qwen-3.7 $0.02
pi-agent
skills · deepseek-v4-pro $0.06
hermes-agent
mcp · minimax/m3 $0.01
openclaw
anthropic · claude-fable-5 $0.11
[bitrouter] optimize · 00c3f1a2
you ❯optimize my coding agent run — cut cost, keep quality
bitrouter thinking…
bitrouter
NORMAL ^a manage · ^b broadcast · : cmd · PgUp/PgDn scroll · ^c quit
no model lock-inswap any model, open or frontier, per call
no harness lock-inClaude Code, Cursor, Codex — or your own
no gateway lock-inopen-sourced, cloud opt-in
// the trade-off

Cheap, fast, right — you don’t have to pick.

Run every call on a frontier model and you’re tokenmaxxing — you overpay, and you’re slow. Make everything cheap and the hard calls get it wrong. BitRouter routes each call to the cheapest model that still clears your bar — and lets you set where that bar is.

optimize · cost

A 200-file refactor — ~2,400 model calls in one run.

Today. Billed at frontier prices the run costs $2.10, and ~90% of those calls were trivial reads and edits. That's tokenmaxxing — top-tier rates for work any open model handles.
BitRouter. Routed the routine 2,200 calls to open models and kept the ~200 hard edits on Opus — same diffs, tests green.
−80%
cost / run
cost for this run
all-frontier · $2.10
BitRouter · $0.43
how it routed this run
qwen/qwen-3.7reads · edits · 78%
minimax/m3format · 15%
claude-opus-4.8hard edits · 7%
// measured, not modeled

Same tasks solved. A fraction of the bill.

On Terminal-Bench 2.1, BitRouter routed GPT-5.5’s calls and cut cost ~33% at the same solve rate. Plotted against the vals.ai leaderboard field, the optimized point slides left — same accuracy band, a third cheaper.

metric
terminal-bench-2.1 · vals.ai
TERMINAL-BENCH-2.1 · %COST · $ / TEST88%70%$0.39$3.10↖ betterGPT-5.6 SolClaude Fable 5GPT-5.5Claude Sonnet 5Claude Opus 4.8−33% costGPT-5.5 + BitRouter
gpt-5.5 + bitrouter base model · vals.ai
Terminus 2 · pass@1 · cost/test · log scale

GPT-5.5 + BitRouter applies our measured Terminal-Bench result (−32.8% cost, −1.14pp; run codex-full-a4ce879-c3) to the vals.ai GPT-5.5 baseline. BitRouter was not re-run on Terminus 2.

6 systems
GPT-5.6 SolTerminus 285.77%$1.02373s
Claude Fable 5Terminus 280.52%$1.43505s
GPT-5.5Terminus 276.40%$0.74427s
GPT-5.5 + BitRouterbitrouter · adaptive75.26%$0.50
Claude Sonnet 5Terminus 274.53%$0.80635s
Claude Opus 4.8Terminus 271.91%$2.41930s
Base rows: vals.ai · Terminus 2 · pass@1 · ‡ projected
// how we optimize

Act. Observe. Evaluate. Update.

Not a static router that decides once and rots. BitRouter runs a closed loop on every call — act, observe, evaluate, then update the routing policy — so it gets cheaper and sharper each lap, with no tuning by you.

01 Act

Route each call to the model that fits.

Routine calls go to open models; the hard ones escalate to frontier — the cheapest model that still clears the bar, decided per call.

in the request pathintent-aware
┌ route · livelast 4 calls
requestcxroutedcostdecision
fix auth.py test0.18qwen/qwen-3.7$0.002open
summarize thread0.12qwen/qwen-3.7$0.002open
design migration plan0.62gpt-5.5$0.021frontier
rank retrieval hits0.30deepseek-v4$0.003open
rule  complexity ≤ 0.55→ open pool  ·  else → frontier
02 Observe

See every call, per run.

Cost, latency and outcome traced for each call and attributed to the run — in the request path, nothing to bolt on.

no SDKper-run traces
┌ trace · run #1428newest first
calls 12total $0.026p50 88ms
timemodelcostlatst
14:22:01qwen/qwen-3.7$0.00282msok
14:22:00qwen/qwen-3.7$0.00291msok
14:21:58deepseek-v4$0.003101msok
14:21:55gpt-5.5$0.021140msok
03 Evaluate

Score what the call actually needed.

Each call is scored by complexity against the policy threshold — so the next decision knows when an open model is enough and when to escalate.

complexity scoringquality floor
┌ eval · floor 0.85threshold 0.55
requestcxbarqverdict
fix auth.py test0.18▓▓░░░░░░░░0.91open holds it
rank retrieval hits0.30▓▓▓░░░░░░░0.88open holds it
design migration plan0.62▓▓▓▓▓▓░░░░0.94escalate
04 LEARN

Tune the policy from what it learned.

Every lap folds the traces back into the routing policy — the threshold and model mix shift, and the cost per run keeps dropping.

self-tuningcheaper each lap
┌ policy.yaml · committed v.7diff · this lap
cost/run $0.41 $0.43threshold 0.54open 78%
route: optimize: cost - threshold: 0.55 + threshold: 0.54 - cost_per_run: $0.43 + cost_per_run: $0.41 # ↻ feeds the next routing decision
self-tuning — every lap folds traces back into the policy, cheaper each run

Questions before you ship.

Common questions about pricing, routing, and data handling. If yours isn’t here, check the docs or talk to us — we usually reply within a day.

An AI model router is a unified API layer that sits between your AI agent and the upstream LLM providers. Instead of hardcoding a single provider into your application, you point every model call at the router and it intelligently selects the best available model based on cost, latency, capability, and provider health. BitRouter goes further than a simple proxy: it handles failover, per-run observability, prompt-injection guardrails, and task-complexity-based model matching — all without any changes to your agent code.
OpenRouter is a closed-source hosted gateway — no self-host option, no agent-native primitives, no permissionless registry. BitRouter is Apache 2.0: fork the binary and run it anywhere, or use the hosted edge if you don't want to operate it. The provider registry is fully open — anyone can publish a provider via pull request with no review queue or approval process. The result is no lock-in at any layer — swap models, switch agent harnesses, or self-host the router itself — plus router-level guardrails, per-run cost attribution, MCP/ACP/Skills gateway support, and intent-aware routing that OpenRouter does not offer.
LiteLLM is an open-source Python library you embed inside your application code. BitRouter is a standalone binary that runs as a sidecar or hosted edge — you drop it in front of any runtime (Claude Code, Cursor, Codex, your own agent) without modifying each service. It comes with auth, billing, observability, guardrails, and an MCP/ACP/Skills gateway built in. You configure policy once at the router rather than repeating safety and routing logic in every service that calls an LLM.
BitRouter's cost advantage comes from open models: the open provider registry carries Qwen 3.7, DeepSeek V4 Pro, Kimi K2.6, GLM 5.1, MiniMax M3, StepFun 3.7, and Mimo V2.5 Pro, and routes the routine majority of an agent's calls to them at a fraction of frontier prices — any provider hosting a model can publish a listing and receive traffic immediately. Frontier models stay one alias away for the calls that need them: Claude Fable 5 / Claude Opus 4.8 (Anthropic), GPT-5 and o3 (OpenAI), Gemini 3.1 Pro and 3.5 Flash (Google), Grok 4.3 (xAI). The model list updates automatically as providers publish new entries; no binary upgrade or alias change is needed on your end.
Pull the Apache 2.0 binary from github.com/bitrouter/bitrouter — it is a single binary with no daemon, no GUI, and no infrastructure dependencies beyond a network connection. It drops into any container, CI step, or bare VM. Self-hosted BitRouter gives you the same routing engine, guardrails, MCP/ACP/Skills gateway, and observability as the hosted edge, without the platform fee. Your traffic never leaves your infrastructure.
Yes — BitRouter works with any agent harness that supports a configurable base URL or API key. Claude Code, GitHub Copilot, Codex, Opencode, Pi Agent, Hermes, and Openclaw all connect with a two-variable override (ANTHROPIC_BASE_URL or OPENAI_BASE_URL) and zero code changes — routing, failover, cost tracking, and guardrails apply automatically from that point forward. The same pattern works for any harness not yet in the list. Step-by-step setup for each integration is in the cookbook at /docs/integrations.
// routing as code

Start routing in under a minute.

One API key, every model — and your cost policy is a file you own. Smart defaults out of the box; version it, override any call, never a black box.

$curl -fsSL https://bitrouter.ai/install.sh | sh
then bitrouter run claude-code
usage-based pricing — 0% markup on every model·Apache-2.0
Fig. — bitrouter.policy.yaml
1# bitrouter.policy.yaml — context-aware routing, versioned in your repo
2version: 1
3preset: code/balanced # inherit defaults, override below
4
5# what the loop tunes for on every run
6optimize:
7 objective: cost # cost | accuracy | latency | balanced
8 quality_floor: 0.92 # never drop below this eval score
9 max_latency_p95: 1200ms
10
11# model catalogue — aliases → upstream, priced
12models:
13 - id: qwen/qwen-3.7
14 tier: open
15 price_per_mtok: { in: 0.14, out: 0.28 }
16 - id: deepseek/deepseek-v4-pro
17 tier: open
18 price_per_mtok: { in: 0.27, out: 1.10 }
19 - id: anthropic/claude-opus-4.8
20 tier: frontier
21 price_per_mtok: { in: 15.0, out: 75.0 }
22
23# routing rules — first match wins; re-scored per call
24routes:
25 - match: { intent: [lookup, format, classify] }
26 use: qwen/qwen-3.7
27 - match: { complexity: ">=0.6" }
28 use: deepseek/deepseek-v4-pro
29 - match: { complexity: ">=0.85", tokens_in: ">8k" }
30 use: anthropic/claude-opus-4.8
31
32fallbacks: # transparent, mid-run
33 - on: [429, 5xx, timeout]
34 chain: [anthropic, deepseek, google]
35
36guardrails:
37 prompt_injection: block
38 pii: redact # email · card · ssn
39 spend_per_run: $5.00
40 loop_guard: true
41
42overrides:
43 "src/checkout/**": anthropic/claude-opus-4.8 # you keep the wheel
44
45telemetry:
46 attribution: per_run # cost + latency per call chain
47 retention: none # zero content capture by default