Skip to main content
The gateway serves three protocols and a model list. Its base URL is wherever you started it, such as http://127.0.0.1:8080.

Routes

Each protocol route is also served under a router’s name: /<router>/v1/messages, /<router>/v1/chat/completions, and so on. Without a name, /v1/... uses the default router. The CLI’s subscription commands use /v1/organizations/current/credentials/.... You do not need to call those routes directly.

Router Specs

dari router reads and saves router spec files through these routes. They take any gateway key.

Model Lists

The model picker reads and changes a router’s model lists through these routes. They take any gateway key, and /<router>/v1/router/models reaches a router other than default. A PUT body is {"models": [...]}, with entries written as in the config file: a model id, or an object with id and thinking. A list the config file would refuse is refused with 400. Every route answers with the lists as served after the change:
chosen is false while the router serves the gateway’s built-in default models: no config file is loaded and no list is saved. Set "stream": true to receive server-sent events from the three generation routes.

Authentication

Send a gateway key from DARI_GATEWAY_KEYS as a bearer token:
Anthropic clients may send the key in x-api-key instead. Provider keys are never sent by clients; the gateway holds them.

Choosing A Model

The model field in a generation request selects how the router picks: The <id> is a model id such as anthropic/claude-sonnet-5-5. See Models.

Response Headers

Every generation response includes headers that status lines and tools can read:

Errors

Errors carry an HTTP status, a message, and a code. Common ones: For provider failures, the gateway retries and fails over to the router’s next model before it returns an error.

Examples

Chat Completions with the router’s choice:
Anthropic Messages, pinned to one model on the local router: