Skip to main content
Dari Router accepts OpenAI-style tools and tool_choice fields. The router selects a model, forwards the tool definitions to that model’s provider, and returns assistant tool calls in the standard chat completions shape.

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": "user", "content": "What is the weather in San Francisco?"}
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get current weather for a city.",
          "parameters": {
            "type": "object",
            "properties": {
              "city": {"type": "string"}
            },
            "required": ["city"]
          }
        }
      }
    ]
  }'

Response

If the selected model calls a tool, the response includes tool_calls:
{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_0",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\":\"San Francisco\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ],
  "dari_routing": {
    "requested_model": "dari/routing",
    "selected_model": "openai/gpt-5.5",
    "reason": "The request can be answered by a general tool-capable model."
  }
}
Send the tool result back as another chat completion request using the same OpenAI-style message history and a tool role message.