Skip to main content
Dari Gateway is the open-source runtime behind Dari’s hosted routing service. One endpoint speaks Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses. It serves each request with your provider API keys or your connected Claude Code and ChatGPT subscriptions, and retries the router’s next model when a provider fails. It needs no Dari account.

Run It

The gateway needs Bun 1.3 or later. From the dari-gateway directory:
Provider API keys use each provider’s standard variable, such as ANTHROPIC_API_KEY, OPENAI_API_KEY, or OPENROUTER_API_KEY.

Configure Routers

Send model: "dari/model/<id>" to pin one of a router’s models, or model: "dari/routing" to let the router choose. Without DARI_AUTO_ROUTING_API_KEY, dari/routing serves the router’s first model that has a credential, and falls back down the list on provider failures.

Connect Subscriptions

Point the Dari CLI at your gateway and connect plans:
Connect more than one account per provider to pool them. The gateway stays on one subscription until the provider reports a usage limit, holds it until its reset, then moves to the next. When every subscription for a provider is held, that provider’s API key serves if you set one. A Claude Code subscription serves Anthropic models only for Claude Code; a ChatGPT subscription serves OpenAI models for every client.

Launch Coding Agents

With DARI_GATEWAY_URL and DARI_GATEWAY_KEY set, the launchers make no calls to Dari’s hosted API:
Status lines show the serving model, thinking level, and prompt-cache warmth, as they do with the hosted service. dari router request-costs and dari credentials subscription auto-reset are hosted-only.