> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dari.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Completions API

> Send a routed OpenAI-compatible chat completion request

**Authorization** `string` *required*

`Bearer` plus a Routing API key.

**model** `string` *required*

`dari/routing`, or `dari/model/<model_id>` to pin one enabled model.

**messages** `array` *required*

OpenAI-style messages.

**stream** `boolean`

Stream with Server-Sent Events.

**tools** `array`

OpenAI-style tool definitions.

**reasoning\_effort** `string`

Require the selected model to use exactly `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. Models that do not support that level are ineligible.

```bash cURL theme={null}
curl https://routing.dari.dev/v1/chat/completions \
  -H "Authorization: Bearer $DARI_ROUTING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dari/routing",
    "messages": [{"role": "user", "content": "Hello from Dari"}]
  }'
```

The response follows the OpenAI Chat Completions shape. `dari_routing` adds `selected_model`, `reasoning_effort`, `reason`, and `conversation_id`.

`usage.cost` is the model reference cost in USD, using the same response field as OpenRouter. Streaming responses include it in the terminal usage chunk. It includes known provider-attempt costs, including charged retries, but excludes sandbox charges, selector infrastructure, and Dari router fees. Subscription-backed models use reference rates, not a cash invoice. Unknown or estimated usage returns `null`, never an assumed zero. Provider error responses include `usage.cost` when the model cost is known; a disconnected stream may end before its price reaches the client.

The `/v1` endpoint uses your organization's default router. To address a specific router instead, send the same request to `https://routing.dari.dev/{router_id}/chat/completions`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.