Frontier prices for everyday work
Send everything to the biggest model and you pay top rate for requests a cheap model would have answered correctly.
Open source · Apache-2.0 · v0.9.2
Firstpass sends every LLM request to the cheapest model first, runs your check on the real output, and escalates one rung only when that check fails. Every decision leaves a receipt anyone can re-verify.
A drop-in proxy for Anthropic- and OpenAI-compatible APIs. Leaving is one unset.
The problem
Send everything to the biggest model and you pay top rate for requests a cheap model would have answered correctly.
A classifier or price list picks a model before any output exists. When it guesses wrong, you find out in production.
Either way, nothing explains why a request went where it did, or proves the answer was checked before it shipped.
How it works
The question “is this good enough to serve?” can only be answered once there is an answer. So Firstpass gets one cheaply, then checks it.
Every request opens on the least expensive rung of the model ladder you configure. No classifier picks the model.
A gate is your definition of “good”: your test suite, a JSON schema, an LLM judge, or self-consistency across samples. A gate that errors abstains. It never passes by default.
Pass, and the answer is served. Fail, and Firstpass climbs exactly one rung and gates again. The expensive model is spent only when the cheap one is shown not to be enough.
{
"prev_hash": "9f2c…a1b7", // links to the decision before
"attempts": [
{ "rung": 0, "model": "claude-haiku-4-5",
"gates": [{ "gate_id": "tests", "verdict": "fail" }] },
{ "rung": 1, "model": "claude-sonnet-5",
"gates": [{ "gate_id": "tests", "verdict": "pass" }] }
],
"final": { "served_rung": 1 },
"hash": "5c02…a91f"
}Every decision is hash-chained. firstpass export writes the log; firstpass verify re-derives the chain on your own machine, with no proxy or database. Alter or reorder one record and it fails at that record. Receipts & audit →
Proof
Every number below links to the committed artifact that produced it, and comes with the conditions it was measured under.
Quality · MBPP, 974 real tasks
+15.2points
over always serving the cheap model, and 0 of 974 tasks made worse.
Gated escalation on a haiku → opus ladder, paired against always-cheap. 95% CI [+12.9, +17.5].
On this workload the gate runs asserts that are also shown in the prompt, so it is partly self-grading.
Cost · MBPP, 974 real tasks
12–57%lower
cost per successful task than always using the top model.
12% with sonnet as the top rung, 57% with opus as the top rung.
Always-top still wins on raw success: by 1.5 points on the sonnet ladder and 2.3 points on the opus ladder.
Served failures · one live run
7.7%served wrong
against a ≤10% target at 95% confidence, earned on this run.
One run on one dataset (MBPP). The bound is earned per run, not a universal promise. The gate’s false-accept rate is stated, not hidden.
Agents · 500 SWE-bench Verified runs
71%lower cost
by choosing one model per workload on evidence: 374/500 resolved vs 384/500 for always-opus.
The difference in resolved tasks is not statistically significant. Per-request cascades did not beat always-top on agent runs, and we say so.
Public leaderboard trajectories, one recorded run per model, one scaffold.
More results, including what didn’t work: Benchmarks · all artifacts on GitHub.
It says no, too
Add a challenger model to a route and Firstpass tests it on real traffic, graded by your own gates. A statistical test that stays valid however often you look ends in certified or halted. A halted challenger is stopped automatically. Adopting a certified one is a config change you make. It never switches models on its own.
We ran it live on real Anthropic calls, with haiku-4-5 challenging sonnet-5.
Halted
MBPP · 974 pairs
Haiku costs 0.30× as much per request. Firstpass still proved it worse and stopped it, long before the run ended. It halts in 100 of 100 random orderings of the same pairs.
Undecided
APPS · 290 contest problems
Haiku is 0.09× the cost here, which is tempting. But 65.2% vs 60.7% is too near the margin to decide, and it stayed undecided in 194 of 200 random orderings. “Not yet” is the right answer.
Fixed
found by the live run, fixed with tests
Coding agents
Claude Code, Codex and aider talk to Firstpass over the wire formats they already speak. Observe mode forwards byte-identical and writes receipts. Enforce mode gates tool calls, groups turns into sessions with no header, and keeps a session on one model.
Setup
Claude Code · Codex · aider
Claude Code: ANTHROPIC_BASE_URL or firstpass launch claude. Codex: firstpass launch codex, which sets OPENAI_BASE_URL. aider: --openai-api-base.
In observe mode the upstream’s retry-after, request-id and rate-limit headers are relayed so agents back off correctly, and count_tokens is passed through.
Enforce
built-in gate: tool-args-valid
A reply that only calls a tool is not “empty”. The tool-args-valid gate checks every call’s arguments against the request’s own schema and fails on a tool that was never declared.
Turns are grouped into sessions with no header (explicit header, agent session header, prompt_cache_key, then a salted prefix hash), so session promotion applies to these agents without config.
Measured
500 real SWE-bench agent runs · $0 replay
Escalate-and-pin cost +$0.309 to +$0.316 per instance more than always-top at the same 384/500 resolved (haiku to opus). Per-session routing resolved 378/500. Choosing the model per workload was far cheaper (374/500 at $0.219 vs 384/500 at $0.754), but non-inferiority at 1 point was not shown.
Where it fits
Verification needs something to verify against. We’d rather tell you now than after you deploy.
Great fit
Code with tests, structured output against a schema, extraction. The gate is crisp, so every escalation is earned.
Weaker fit
The available gates are an LLM judge or self-consistency. They work, but they are weaker checks than a test suite.
Wrong tool
If your output has no check at all, Firstpass has nothing to decide on. Use something else.
Why now
For a growing share of requests, a cheaper model gives an answer that passes. The hard part is knowing which requests.
An agent session is a long chain of requests. Small per-call choices compound into real spend and real failure rates.
When a model decision affects cost or quality, someone will ask why. A re-derivable receipt is an answer you can hand over.
Get started
It starts in observe mode: it watches your traffic and writes receipts, and changes nothing until you turn on enforcement.
brew install dshakes/tap/firstpass-proxypip install firstpassfirstpass, an unrelated packagenpm i -g firstpass-proxycurl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/dshakes/firstpass/releases/latest/download/firstpass-proxy-installer.sh | shdocker run -p 8080:8080 -e FIRSTPASS_BIND=0.0.0.0:8080 \
ghcr.io/dshakes/firstpass:latestcargo install firstpass-proxyWindows and other binaries: GitHub Releases.
# terminal 1: observe mode changes nothing
firstpass-proxy
# terminal 2: your agent now goes through it
export ANTHROPIC_BASE_URL=http://127.0.0.1:8080
# use your agent; read receipts at http://127.0.0.1:8080/panelNo lock-in. Offboarding is unset ANTHROPIC_BASE_URL. Your keys pass straight through to your provider.
Next: Quickstart · Write a gate · Configure a ladder
Open source, Apache-2.0, written in Rust.