/v1 for your default router. For a specific router, send the same body to https://routing.dari.dev/{router_id}/chat/completions.
The response follows the OpenAI Chat Completions format and adds dari_routing, which identifies the selected model and reasoning effort.
Streaming
Setstream: true. Dari returns Server-Sent Events in the OpenAI stream format, with dari_routing in the first event and data: [DONE] at the end.
Tool Calls
Send standard OpenAItools and tool_choice fields. If the selected model calls a tool, append the result as a tool message and send the complete message history again.
Conversations and Leases
The router groups requests into conversations and remembers which model served earlier turns. A routing policy can keep later turns on that model for a few turns. This is a lease. Send the same identity on every turn of one conversation, using either:- the
x-session-affinityheader, or - the
prompt_cache_keybody field.
- Identical runs, such as retries of the same task, can match each other. The most recently active run wins.
- Rewriting earlier messages starts a new conversation.
- Compaction that keeps earlier messages intact stays in the same conversation. The conversation is keyed on the system and tools head plus the message prefix.
- Lease position counts the assistant messages in each request. Removing assistant turns moves when the next routing decision happens.