Skip to main content
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

Auto Router supplies a default selector endpoint and selector model. You can override the endpoint for testing. 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.
Review this data flow before you enable Auto Router for sensitive traffic.

Selection leases

A policy may return leaseTurnsRemaining. 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

  • pricing and output-token averages are optional. The hosted Auto Router does its own accounting.
  • If you use self-hosted createDariRoutingPolicy instead, you must provide both yourself.
  • The endpoint client posts to /select. An endpoint that already ends in /select also works.

Choosing an approach

Use Auto Router when you want hosted selection but local execution. Use a local RoutingPolicy 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.