Skip to main content
Router Core is not yet published to a registry. Run from dari-router-core/ in the Dari monorepo.

Try The Example

1

Install and run

No API key needed. It routes by prompt length using an in-memory executor.
2

Make a real provider call

This runs through the built-in Pi runtime with a real OpenAI model.

Create A Server

Send a request:
The response includes the chosen model in dari_routing and the X-Router-Selected-Model header. The incoming model is a caller-facing router name — it does not force the policy to pick that model.

Use From A Sibling Project

1

Build the package

2

Add the dependency

The package emits ESM in dist/. It requires Bun or Node.js 22.19+ and uses web-standard Request, Response, and AbortSignal. Bun can serve router.fetch directly; Node needs a Request/Response adapter.

Next Steps

Models

Declare candidates and eligibility.

Policies

Write routing policies.

Pi Runtime

Credentials for multiple providers.

Custom Executors

Integrate another SDK.

Protocols And Streaming

Request and streaming details.