Skip to main content
Send requests to the router-specific chat completions endpoint with model: "dari/routing". Dari Router selects one enabled model, forwards the request to that model’s provider, and returns an OpenAI-compatible response.

Request

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": "system", "content": "You are concise and practical."},
      {"role": "user", "content": "Draft a customer support reply."}
    ],
    "temperature": 0.2,
    "max_tokens": 600
  }'

Required Fields

FieldRequiredDetails
modelYesMust be dari/routing.
messagesYesOpenAI-style chat messages. At least one message is required.

Common Optional Fields

FieldDetails
streamSet to true for Server-Sent Events.
temperatureSampling temperature forwarded to the selected provider.
top_pNucleus sampling value forwarded to the selected provider.
max_tokensMaximum output tokens.
max_completion_tokensAlternative maximum output token field used by newer OpenAI clients.
stopStop sequence or sequences.
toolsOpenAI-style tool definitions.
tool_choiceOpenAI-style tool choice.
response_formatText, JSON object, or JSON schema response format.
metadataApplication metadata forwarded with the request where supported.
userEnd-user identifier forwarded with the request where supported.
routing.instructionsRequest-specific guidance for model selection.

Response

{
  "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 support reply..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 154,
    "completion_tokens": 96,
    "total_tokens": 250
  },
  "dari_routing": {
    "requested_model": "dari/routing",
    "selected_model": "openai/gpt-5.5",
    "reason": "The request is a straightforward writing task."
  }
}
Use model or dari_routing.selected_model to record which provider model actually served the request.