MIT · open-source · works with any agent that reads a SKILL.md
Undercut is a SKILL.md your coding agent follows at dispatch time. Six-flag rubric assigns a base tier. Objective evidence — not self-reported confidence — is the only thing allowed to escalate it.
Measured on public benchmarks, official test cases, deterministic graders: up to −95% cost on HumanEval, up to −71% on GSM8K — equal-or-better pass rate. Raw results →
Every session your agent runs on all-standard routing between now and whenever you install this, it's paying top-tier prices for work a cheap tier could have passed. That's not a countdown timer — it's just what the token bill already does.
For your team
Objective escalation triggers, not confidence thresholds. Vendor-agnostic rubric. Published, reproducible methodology — re-run our exact benchmarks on your own tasks.
No new vendor contract. No network-layer access, no proxy sitting between your agent and its model calls. MIT license, free, and every cost claim on this page is backed by public, auditable results — not a vendor's internal number.
Your coding agent gets cheaper automatically. Nothing to configure, nothing to learn about routing rubrics — install it, and the easy work stops burning top-tier tokens.
The problem
Claude Code, Codex, Cursor, and Copilot let you set a model once per session. That session then handles trivial, mechanical work at the same tier as genuinely hard reasoning. One Claude Code Max subscriber's self-reported usage data showed 93.8% of their tokens going to the top-tier model — with nothing pulling cheap, mechanical work back down.
It's one user's numbers, not an industry audit — the GitHub issue has stayed open with real engagement, which suggests the pattern isn't unique to one account.
Ask the model how confident it is, and route on that. Except LLM self-reported confidence is poorly calibrated — a model that's wrong is often just as "confident" as one that's right. A confidence threshold buys the feeling of a safety check without the substance.
Undercut replaces confidence with three objective triggers: a failed verification, a measured disagreement between two cheap-tier runs, or an explicit uncertainty flag. Nothing escalates on a vibe.
vs. cap-based routers
Most "cost control" tooling watches the meter: every unit still runs at the top tier until a budget cap stops the whole session. Undercut decides the tier per unit, before it runs — the cap never has to save you because the spend never happens.
Every unit runs at the same tier. The only lever is stopping — quality of routing never changes, spending just ends.
Each unit gets the cheapest tier that can pass verification. Escalation happens on evidence, one tier at a time — and only for the units that need it.
They compose: Undercut routes first, your gateway's caps and compression still apply to whatever runs.
The proof — measured, not modeled
| Vendor | all-standard | tiered | Cost | Pass |
|---|---|---|---|---|
| OpenAI | 241/250 · $0.60 | 249/250 · $0.17 | −71% | +8 |
| Gemini | 250/250 · $1.28 | 248/250 · $0.53 | −59% | −2 (seed noise) |
| Anthropic | 249/250 · $0.36 | 250/250 · $0.35 | −4% | +1 |
| Open-weights | 240/250 · $0.02 | 245/250 · $0.07 | +228%* | +5 |
*Open-weights price ladders invert — see caveats. Absolute overhead is ~$0.01–0.02.
| Vendor | all-standard | tiered | Cost | Pass |
|---|---|---|---|---|
| Gemini | 100/100 · $1.13 | 100/100 · $0.05 | −95% | = |
| Anthropic | 100/100 · $0.30 | 100/100 · $0.12 | −61% | = |
| OpenAI | 100/100 · $0.46 | 100/100 · $1.23 | NA* | = |
| Open-weights | 100/100 · $0.01 | 100/100 · $0.02 | +77%* | = |
*OpenAI's cheapest tier can't write Python, so every task escalates the full ladder. Quality holds at 100/100 — the escalator works — there's just no cost headroom to exploit on that family for this benchmark.
Secondary evidence — clearly labeled oursOn our own 30-task synthetic suite (code, reasoning, mechanical — 150 units/cell), tiered was never worse than all-standard on any cell, and beat it on 6 of 12. The escalator recovers failures a fixed single tier gives up on — it's not just cheaper, it's smarter on the cells where it wins.
Read the benchmarksHow it works
Every unit of work gets scored against six flags, then assigned the cheapest tier that can plausibly handle it. It only moves up a tier when something objective proves it needs to — a failed check, a measured disagreement, an explicit uncertainty flag. It never moves up on a guess, and it never moves back down mid-task.
0 flags → cheap · 1–2 → standard · 3+ or any ownership/judgment call → frontier. Apex only when you can write one sentence stating why the marginal intelligence pays for the cost.
Cheap-to-verify ⇒ cheap-to-generate. If output can be checked mechanically, it starts at the lowest tier regardless of how hard it looks — verification catches failure. Only unverifiable work needs to start high.
The next tier up gets only the failed or uncertain items, plus verification notes. It resolves the residue — it never redoes the batch.
Never de-escalate mid-task. Max one retry per tier. Anything still unresolved goes to a single batched apex tie-break call. One hard file in a 700-file job doesn't drag the other 699 up a tier.
unit of work
|
6-flag rubric
|
+---+----+
| 0 flags|--> cheap
| 1-2 |--> standard
| 3+/own |--> frontier
+---+----+
| fail x2 / disagree / uncertain
v
escalate +1 tier
(residue only)
|
still unresolved?
v
single batched
apex tie-break
Why it holds up
Even when the rubric flags are scored imperfectly, the escalator still routes work to the right tier almost every time — because a wrong flag only ever costs one extra cheap attempt, never a wrong answer or a big bill.
A stock dispatcher model reproduces the rubric flags imperfectly — Haiku hits 90% agreement, Sonnet 93%. The weakest flag (format-strict) is only 60%. None of that matters: under the shipped policy, both dispatchers still route 100% of units to the correct tier. A wrong flag changes the ladder cap, never the base tier — worst case, one extra cheap attempt.
Every rule is a property of the unit of work — verifiable, ambiguous, blast-radius — never a specific model's known weakness. Vendor cards go stale as models change; work properties don't. It's also hard-won — a format-strict rule that worked on Anthropic backfired on Gemini, which is exactly why the rubric no longer encodes per-vendor behavior.
Honest limits — and what this means for governance
For finance & procurement
No new vendor contract to negotiate. No network-layer access — it's a policy file your agent reads, not a service that sits between your agent and its model calls. MIT licensed, free to run. Every cost and quality claim on this page traces to public, re-runnable benchmark data — not an internal vendor number you have to take on faith.
For teams
Undercut is free and MIT — it routes the developer who installs it. But a team can't rely on every dev opting in. Undercut for Teams enforces the routing policy across every account in your org, meters the savings, and gives you a signed ledger of every escalation — proof no unit silently over-routed.
One policy, applied to every member's agent. No one can silently route to the top tier.
Every routing decision is recorded and verifiable. You see per-account savings, not a vendor's internal number.
Provision and de-provision seats automatically. Governance, not a shared config file.
Try it
or copy skills/firstpass/ straight into your agent's skills directory.
testing/README.md and the raw JSON in testing/results/node src/main.js --mocknode src/main.js --compare a.json b.jsonZero lock-in. It's a policy your agent follows — remove the skill and you're back to status quo.
Not the one setting this up? Forward this page. Everything above the install command reads without a technical background — the engineer on your team just needs the command block.
Prior art
peragwin's subagent-model-routing gist and soumabali/token-router both explored assigning cheaper models to subagent work. Undercut adds the objective escalation loop on top: measured disagreement instead of self-reported confidence, hysteresis so a run can't thrash between tiers, residue-only escalation with a structured handoff, a calibration feedback loop, and — the part that's actually rare in this category — published, reproducible A/B results. Anyone can re-verify any cell in the tables above.
Compression proxies like Edgee shrink what goes over the wire for a given call. Undercut decides which model handles the call in the first place. Route first, compress second — they stack.
{{ faq.a }}
Nothing about this page expires. What does keep happening is the token bill, one session at a time, on whatever your agent is currently doing with mechanical work.