Skip to main content
This quickstart creates a Dari Router and sends an OpenAI-compatible chat completion request through it.

1. Create A Router

Open the Dari dashboard and create a router. Give it a name, choose the models it may serve, and choose a key source for every selected provider. You can use Dari-managed provider keys or bring your own OpenAI, Anthropic, and OpenRouter keys. For example, a router with openai/gpt-5.5, anthropic/claude-sonnet-4-6, and openrouter/google/gemini-3.1-pro-preview needs key sources for OpenAI, Anthropic, and OpenRouter. The fastest setup is to leave each provider on Dari-managed.

2. Create A Routing API Key

In the Dari dashboard, go to API Keys, create a key with the Routing scope, and store it as an environment variable:
export DARI_ROUTING_API_KEY=dari_...

3. Copy The Router Endpoint

The router detail page shows an endpoint like this:
https://routing.dari.dev/rtr_123/chat/completions
Store it as an environment variable:
export DARI_ROUTER_URL=https://routing.dari.dev/rtr_123/chat/completions

4. Send A Request

curl "$DARI_ROUTER_URL" \
  -H "Authorization: Bearer $DARI_ROUTING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dari/routing",
    "messages": [
      {"role": "user", "content": "Write a launch checklist for a new API."}
    ]
  }'
The response is an OpenAI-compatible chat completion with routing metadata:
{
  "id": "chatcmpl-req_123",
  "object": "chat.completion",
  "model": "anthropic/claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is a practical launch checklist..."
      },
      "finish_reason": "stop"
    }
  ],
  "dari_routing": {
    "requested_model": "dari/routing",
    "selected_model": "anthropic/claude-sonnet-4-6",
    "reason": "The request benefits from strong planning and writing quality."
  }
}

Next Steps