Skip to main content
Dari Gateway is the open-source runtime behind Dari’s hosted routing service, packaged to run on your own machine. Point a client at it and each request is served by a model from your router, using your provider API keys or your connected Claude Code, ChatGPT, or Muse Code subscriptions. It needs no Dari account.

What It Does

  • One endpoint, three protocols. Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses share one server, along with a model list.
  • Routers. Each router is a named set of models and settings, served on its own path.
  • Your credentials. Serve from provider API keys, connected subscriptions, or both. Several subscriptions per provider are pooled.
  • Failover. A provider failure retries the router’s next model.
  • Prompt-cache aware. Conversations keep their identity and serving model across turns, so provider caches stay warm.

How A Request Is Served

  1. Authenticate. The client sends one of your gateway keys (DARI_GATEWAY_KEYS) as a bearer token.
  2. Pick the router. /v1/... uses the default router. /<router>/v1/... uses the router with that name.
  3. Pick the model. dari/model/<id> serves exactly that model. dari/routing lets the router choose: with DARI_AUTO_ROUTING_API_KEY set, Dari Auto Routing picks, and without it the first model in the list that has a credential serves.
  4. Pick the credential. With subscriptions: true, a connected subscription serves first. Otherwise, or when every subscription is held, the provider’s API key serves.
  5. Call the provider. A failed call retries the same model up to retries times, then moves to the next model.

Hosted Or Self-Hosted

Observability needs hosted Dari. Requests served by a self-hosted gateway never reach Dari, so there is no Activity dashboard, per-request cost, or usage analytics for them. If you need those, use hosted routing.

Start Here

Quickstart

Run the gateway and send it a first request.

Configure Routers

Choose the models and settings each router serves.

Subscriptions

Connect and pool Claude Code, ChatGPT, and Muse Code plans.

Coding Agents

Launch Claude Code, Codex, and other agents against the gateway.
The source is in packages/gateway of github.com/mupt-ai/dari, under Apache-2.0.