How It Works
On the first turn, Dari has no previous route and selects a model before provider execution. On an eligible follow-up, Dari:- Recovers the model and reasoning effort previously saved for this follow-up.
- Confirms that pair still satisfies the current request and router configuration.
- Starts that provider request while the selector evaluates the conversation.
- Serves the current turn from the model that was started.
- Stores the selector’s decision as the route to start on the next follow-up.
X-Dari-Selected-Model and the response’s routing metadata is always the model that served the current turn. If the selector chooses a different model, that change applies on the next turn.
When Dari Does Not Speculate
A request remains selector-first when:- it is the first turn;
- there is no recoverable previous decision;
- the previous model or reasoning effort was removed from the router;
- the current request needs unsupported images, tools, structured output, streaming, or reasoning;
- a Describe Your Router rule no longer permits the previous pair;
- speculative provider setup cannot begin safely.
Failure Behavior
If the speculative provider attempt fails, Dari waits for the selector and executes the selected route using the router’s retry and fallback settings. If selection fails after a valid speculative route has started, the current turn can continue on that route. Dari keeps it for the next turn rather than recording a selector decision that never completed. Provider usage, retries, and model activity are attributed to the model that actually served the request.Configure It
Open the router in the Dari dashboard, find Speculative Routing, and switch it on or off. Disabling it restores selector-first execution for every turn. Speculative routing is independent from Primary Retries and Model Fallback. Those settings determine recovery after provider failure; speculation determines whether an eligible provider call may begin before selection finishes.Framework Implementations
The self-hosted framework does not perform this orchestration throughcreateRouter(). Its lower-level prepareRoute() and finalizeRoute() APIs expose the phases needed for a custom host to implement it. See Framework Speculative Routing.