Skip to main content
POST
/
{router_id}
/
chat
/
completions
curl https://routing.dari.dev/rtr_123/chat/completions \
  -H "Authorization: Bearer $DARI_ROUTING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dari/routing",
    "messages": [
      {"role": "user", "content": "Write a concise incident summary."}
    ]
  }'
{
  "id": "chatcmpl-req_123",
  "object": "chat.completion",
  "created": 1780766400,
  "model": "openai/gpt-5.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is a concise incident summary..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 80,
    "completion_tokens": 45,
    "total_tokens": 125
  },
  "dari_routing": {
    "requested_model": "dari/routing",
    "selected_model": "openai/gpt-5.5",
    "reason": "The request is a concise writing task."
  }
}
Send a chat completion request through one Dari Router. The request must use model: "dari/routing". The router selects one enabled model and returns an OpenAI-compatible response with dari_routing metadata.

Path Parameters

router_id
string
required
Router ID.

Headers

Authorization
string
required
Bearer token using a Dari API key with the routing scope.
Content-Type
string
required
Must be application/json.

Body

model
string
required
Must be dari/routing.
messages
array
required
OpenAI-style chat messages. At least one message is required.
stream
boolean
Set to true to receive Server-Sent Events.
routing.instructions
string
Request-specific guidance for choosing between the router’s enabled models.
tools
array
OpenAI-style tool definitions.
tool_choice
string | object
OpenAI-style tool choice.
response_format
object
Text, JSON object, or JSON schema response format.

Request Example

curl https://routing.dari.dev/rtr_123/chat/completions \
  -H "Authorization: Bearer $DARI_ROUTING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dari/routing",
    "messages": [
      {"role": "user", "content": "Write a concise incident summary."}
    ]
  }'

Response Fields

model
string
The selected provider model that served the request.
choices
array
OpenAI-compatible chat completion choices.
usage
object
Token usage when available from the selected provider.
dari_routing
object
Routing metadata.
dari_routing.requested_model
string
Always dari/routing.
dari_routing.selected_model
string
The selected provider model.
dari_routing.reason
string
A short explanation for the routing decision.
{
  "id": "chatcmpl-req_123",
  "object": "chat.completion",
  "created": 1780766400,
  "model": "openai/gpt-5.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is a concise incident summary..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 80,
    "completion_tokens": 45,
    "total_tokens": 125
  },
  "dari_routing": {
    "requested_model": "dari/routing",
    "selected_model": "openai/gpt-5.5",
    "reason": "The request is a concise writing task."
  }
}