Open source · Python · MIT

ladder: the cheapest LLM that still passes

Run recurring LLM work on the cheapest model tier that still passes an external gate, and let the run history, not a guess, decide which model that is.

View on GitHub Getting started Sponsor

Why

Everything runs on the expensive model because nobody knows which tasks need it. Fixed configurations overspend, and learned routers that predict per-query difficulty often fail to beat simply using the best single model. ladder takes a different route: don't predict difficulty; measure it. It occasionally trials a cheaper rung, checks every result with a verifier outside the model that produced it, and promotes or demotes based on counted verdicts. Nothing is ever promoted because a model said it was confident.

How it works

1. Lane before tier

The same model costs very different amounts depending on how you reach it. A plain HTTP endpoint sent about 91 input tokens for a one-word prompt; a coding-agent CLI sent about 22,800. Choosing the lane matters roughly 250 times more than choosing the model, so a tier is a (surface, model) pair.

2. Cross-family gate

Every return is judged outside the model that produced it, cheapest stage first: a free script check, then a cheap verifier from a different model family, then a peer-or-stronger judge from a different family. A model never judges its own output.

3. The learning loop

Each capability starts at a pessimistic floor. 15% of dispatches trial the cheapest undecided rung. Promotion needs 12 trials above the bar; demotion does not. Transport failures (timeouts, 401, 502) stay out of the pass rate, so an outage never pushes routing up the ladder.

Quick start

Python 3.11+. Standard library only. No build step, no account, no cost.

git clone https://github.com/RavenRepo/ladder.git && cd ladder
./ladder probe                                # which surfaces are reachable
./ladder lint                                 # check every launch against its own gate
./ladder run triage-failures --dispatch mock  # full pipeline, fake agents, zero cost
./ladder policy                               # what the system now believes
python3 -m unittest discover -s tests -t .    # 79 tests, under 0.1 s, zero tokens

Failure classes that keep the numbers honest

ClassMeaningEffect
passedcleared every gate stagecounts toward promotion
quality failedreal return, failed a gateretried one rung up with the reason
transport failednever answeredretried; excluded from the pass rate
malformedanswered outside the schemadropped; counts against the rung
deferredpassed with confidence below 0.5escalated one rung; excluded from the pass rate

FAQ

How do I reduce LLM API costs without losing quality?

Measure instead of guessing. ladder starts every recurring task at a deliberately pessimistic floor model, trials a cheaper rung on 15% of dispatches, checks every result with a verifier from a different model family, and only promotes a cheaper model after 12 trials above the bar.

How is ladder different from an LLM router?

Most routers predict per-query difficulty. ladder does not: it learns per capability (a recurring class of work) from counted, externally verified outcomes, and it never promotes a model because the model said it was confident.

Why does the API surface matter more than the model?

In ladder's measurements the same model cost about 250 times more through a coding-agent CLI than through a plain HTTP endpoint, because the CLI adds about 22,800 tokens of harness to every call. ladder treats a tier as a surface and model pair.

What does it take to try ladder?

Python 3.11 or later and nothing else: ladder uses only the standard library. The mock dispatcher runs the full pipeline for free, and the 79 tests run in under a tenth of a second without network access or tokens.

Who built ladder?

ladder is built and maintained by Amit Kumar (@growthperclick), a founder and AI engineer who builds open tooling that makes AI coding agents trustworthy and affordable.

About the author

Amit Kumar spent 16 years in growth and go-to-market before building AI agent systems. He runs Claude Code and Codex agents every day and builds the tooling around them: model routing, evals, guardrails and governance. More at growthperclick.com.

If ladder cuts your model bill, please consider sponsoring its development.