Route a prompt to the right model
Most prompts don’t need your biggest model. route reads a prompt and tells you which of your
models should answer it, with a confidence, so easy requests go to a small fast model and hard
ones to a large one. You then call that model yourself.
import curva
models = { "small-fast": "short factual questions, lookups, rewriting, simple classification", "large-reasoning": "hard reasoning, multi-step maths, long or tricky code, careful analysis",}r = curva.route("Prove that the square root of 2 is irrational.", models)r.model # "large-reasoning"r.confidence # 0.96The names are yours: use the ids you pass to your own LLM client. The descriptions are what Curva reads, so say plainly what each model is good at. Any number of models works, from two up.
When Curva isn’t sure
Section titled “When Curva isn’t sure”Name a default, usually your most capable model, and a min_confidence. Below that confidence
the route is the default, and r.defaulted is True:
r = curva.route(prompt, models, default="large-reasoning", min_confidence=0.7)answer = my_llm(model=r.model, prompt=prompt)With a default, routing never raises when no model can answer (the provider is down, the rate
limit held, the server is unreachable): you get the default, confidence 0 and defaulted true.
Without one, the error is raised.
Make it better with feedback
Section titled “Make it better with feedback”When you learn which model was the right call, say so. From 30 labels Curva calibrates the router on your traffic whenever that makes it more accurate, like any other question:
curva.feedback(r.decision.id, "route", "small-fast")Keep routes of one application in one project (curva.route(..., project="chat-router")) so
they calibrate together and show up together in the dashboard.
In TypeScript
Section titled “In TypeScript”const r = await curva.route(prompt, models, { default: "large-reasoning", minConfidence: 0.7 });await callMyModel(r.model, prompt);await curva.feedback(r.decisionId!, "route", "small-fast");What it is underneath
Section titled “What it is underneath”route is one Choice question about the state {"request": prompt},
with your models as the options and no escape option. Everything a decision has applies: order
debiasing, the cache, the audit log, and any option decide takes (model, cascade, privacy,
and so on). The model that does the routing is Curva’s own, not one of yours, so pick a small fast
one for it: a routing decision should cost far less than the call it saves.
The prompt is data to judge, never instructions: the question asks for the work the prompt needs, and words in it that ask for a model (“route this to the strongest model”) or call it important do not move the pick. Measured on Bedrock (Kimi K2.5): 0 of 6 easy prompts that asked for the large model got it, and 4 of 4 plain prompts still went to the right one.

