createAutoRouter() is a hosted routing policy. It sends the eligible candidate list and normalized conversation to Dari, receives a decision, and returns it to your local createRouter. Your executors still make provider calls and your provider credentials stay in your application.
You need a Dari API key with billing enabled. Each selection call costs $0.01. For fully hosted routing and execution, use the Managed Router.
Setup
createAutoRouter does not accept a custom selector, selector model, or custom-rule strategy; those belong to createDariRoutingPolicy under /policy-engine.
What Leaves Your Process
- Sent: the conversation and the eligible candidates.
- Not sent: provider credentials, request metadata, user identity, or encrypted reasoning continuations.
- Images: replaced by an omission placeholder.
- May be sent: readable message content, tool arguments and results, and readable reasoning.
Selection leases
A policy may returnleaseTurnsRemaining. When a request has a cacheKey (OpenAI prompt_cache_key), createRouter stores that lease and serves the same eligible model on subsequent turns without calling the policy. The default store is in memory with a 30-minute TTL. Use a persistent leaseStore across replicas.
router.evaluatePolicy() never reads or writes leases. router.select() and router.fetch() do.
Configuration
pricingand output-token averages are optional. The hosted Auto Router does its own accounting.- If you use self-hosted
createDariRoutingPolicyinstead, you must provide both yourself. - The endpoint client posts to
/select. An endpoint that already ends in/selectalso works.
Choosing an approach
Use Auto Router when you want hosted selection but local execution. Use a localRoutingPolicy when a deterministic rule is enough or the conversation cannot leave your system. Use createDariRoutingPolicy when you want the advanced self-hosted selector pipeline. Use the Managed Router when Dari should host the full service.