src/model_tiers.json). Unlike a gateway
that decides inside the proxy at request time, the routing decision is visible and
diffable in git.
Recommend a tier — forge route
Start at the recommended
route.tier and escalate only after an external verifier
fails, never preemptively. This keeps spend down without capping capability when a task
genuinely needs it.Intent, then tier
Routing shares its math with intent detection (src/intent.js): a prompt maps to an
intent by the same exemplar k-NN estimator. Note the two use different stop-sets — route
treats generic verbs (fix / add / build) as complexity noise, but those verbs are
exactly the intent signal.
The tier table
The tier table (src/model_tiers.json) pins public Anthropic model IDs by family
(haiku / sonnet / opus / fable). Doc prices are reconciled against this file by the docs
check, so prose and the table can’t drift.
Self-hosted gateway remap
A self-hosted LiteLLM or proxy gateway serves its own model names, so a stock ID sent verbatim would 404. When a non-default gateway base URL is configured, Forge (src/gateway_model_map.js) fetches GET /v1/models once per process and scores
each advertised id against every tier’s family:
1
Hard family gate
The family word (haiku / sonnet / opus / fable) must match — it is a hard gate.
2
Best overlap wins
Among the family, the
setOverlap coefficient of the tier’s name tokens picks the
best match.3
Tie-break to canonical
Ties break toward the id closest to the canonical name.
forge doctor’s gateway models row prints the resolved tier → model mapping for
verification.
Providers and cost
forge cost --stages reports measured stages only — a stage with no events says
“no data”, never a default. A number is an assumption until measured.