Cost-Weighted Routing
When several models are available — Opus, Sonnet, Haiku, or local models behind a self-hosted odysseus gateway — PRECC routes each task to the one that minimizes expected dollar cost, not token count. A token from a cheap model and a token from an expensive one are not the same cost; the router optimizes the dollar, subject to a measured success floor and a per-category capability floor.
A dollar, not a token, is the unit of cost
For a task of category c, over the capability-eligible candidate models m, the router minimizes the expected price-weighted cost. E[$ | task, m] is the model’s measured mean token cost for that category multiplied by its price per token. A Haiku run that uses more tokens than Opus can still win, because Haiku is several times cheaper per token. Every number in the objective is either measured (oracle token means, recorded success, published model prices) or an explicitly labelled prior — never fabricated.
choose argmin_m E[$ | task, m]
subject to P(success | task, m) >= min_success
capability(m) >= capability_floor(category)
Routing a task
precc route "<task>" categorizes the task, applies the capability floor, ranks the eligible models by expected dollars, and prints the decision. With --execute it dispatches the task to the chosen model through the odysseus session API. Each decision is also seeded into the prediction oracle so its real cost and outcome can be recorded after the task runs.
$ precc route "fix the broken parser"
category : fix (capability floor 0)
→ model : anthropic/claude-haiku-4-5 [Measured, confidence 0.60]
est. cost : $0.0096 (12000 tok)
reason : measured cheapest-capable for `fix` (by cost): claude-haiku-4-5
prediction : #42 (seeded; learner will auto-close after the task runs)
Dollar savings
precc savings adds a dollar section whenever routed tasks have completed. For every routed task it prices the tokens actually spent at the chosen model’s rate and compares them against an always-default-model baseline — tokens held fixed, only the price varies. This is the “cut cost, not just tokens” view; the section stays hidden until real routed data exists, so it never shows fabricated rows.
$ precc savings
Routing cost (USD) — baseline: always claude-opus-4-5
claude-haiku-4-5 : 1 task(s) $ 0.0096 chosen vs $ 0.0600 baseline
claude-sonnet-4-6 : 1 task(s) $ 0.1200 chosen vs $ 0.2000 baseline
total : 2 task(s) $ 0.1296 chosen vs $ 0.2600 baseline
→ saved $0.1304 (50.2% of baseline spend)
The feedback loop
Routing improves itself: route → execute → record → retrain. Each routed decision is seeded into the oracle; the background precc-learner daemon fetches the completed message, records the actual tokens, model, and success, and closes the row. As the per-(model, category) table fills in, the router shifts from cheapest-capable priors to measured choices, and the token predictor gains a per-model dimension.
Exploration
To avoid exploiting one cheap model forever on stale data, the router can deliberately sample an under-explored (model, category) cell before the greedy pick. Exploration is opt-in, deterministic (no randomness — the hook must be reproducible), and bounded: it never crosses the capability or measured-success floors, and a price-regret cap keeps it from straying onto a far pricier model.
# ~/.config/precc/odysseus.toml
explore_n_min = 3 # sample each (model, category) cell ~3× before trusting it
explore_eps = 1.0 # allow up to 2× the cheapest price while exploring
Measured, never assumed
A model is only ruled out for failing the success floor when there is measured evidence it does — an un-measured model is never excluded on a guessed number. With no data for a cell the router falls back to a conservative cheapest-capable prior and labels the decision a cold start, so the caller always knows whether the choice rests on evidence or on a prior.