Router and rules “Can we stop a runaway loop?”

Set the rules once.
The router enforces them.

Send your API calls through one endpoint. It picks a cheaper model where one is enough, uses a backup when a provider fails, and stops a call that breaks your rules before the provider sees it.

Free up to 1M events a month. No card.

What it does

One endpoint.
Each request explained.

Cheaper models, fallbacks and limits at one endpoint. Each request shows the model you asked for, the model that answered and why.

Asked forAnswered byWhy
o1→gpt-4oTask typeRerouted.
gpt-4o→gpt-4oAnswer reused from cacheCached.
claude-sonnet-4-5→claude-sonnet-4-5Model was named in the requestAnswered.
gpt-4o→claude-sonnet-4-5Backup model usedAnswered.
Illustration · Demo data

Router.

One endpoint for your API calls, with fallbacks and caching. Each request shows the model you asked for, the model that answered and why. Router docs →

Free runs on your own provider keys, for the model you name. Paid plans add auto routing, with $25 a month of model spend included.Caching is off until you turn it on.

Router: the model asked for, and the one that answeredRouter: the model asked for, and the one that answered
RouterDemo data
req_9c21e4team Stagingo1
Blocked by No reasoning models in staging: o1 is a blocked model in staging. OpenAI never saw the request.
Illustration · Demo data

Rules.

Allowed models, blocked models and a cost ceiling per request, set by team or environment. A routed call that breaks a rule stops before it reaches the provider. Governance docs →

Rules: allowed and blocked models, and the violations of the last 30 daysRules: allowed and blocked models, and the violations of the last 30 days
RulesDemo data
Set up

Change one setting.
The base URL.

01Point your client at the router.

The OpenAI and Anthropic SDKs read their address and key from environment variables. If your app creates its client without passing them, setting them in its environment is enough.

02Name a model, or send auto.

A request that names a model gets that model. Send auto and the router picks a model for each request.

03Read what happened.

Every call is metered with exact tokens and cost, and shows the model that answered and why.

Start free →Read the router docs
# OpenAI SDKs (Python and Node.js)
OPENAI_BASE_URL="https://router.tokenspend.net/v1"
OPENAI_API_KEY="$TOKEN_METER_KEY"
Your code still decides the model.
In the path, on purpose

What the router
does with a call.

The router is a separate choice from the SDK, for when you want routing, fallbacks and caching.

Speaks the APIs you use.

The OpenAI Chat Completions API, the OpenAI Responses API and the Anthropic Messages API.

Tries a backup.

When a model fails, the router can try another one. One request makes at most three attempts: the first model and up to two more.

Reuses an answer.

With caching on, an identical earlier answer is reused for 15 minutes. A cached answer costs nothing at the provider, and one customer never gets another's answer.

Keeps your keys yours.

Free runs on your own provider keys, for the model you name. Your provider bills you for those calls.

Holds a ceiling.

A cost ceiling per request, and a workspace cap that can be enforced on routed calls. Budgets →

Counts savings plainly.

The same tokens are priced on the model each request would otherwise have used and on the model that served it. Fallbacks are never counted as savings. Methodology →

Auto routing 

One goal,
and the models it may pick.

Send auto as the model and the router picks a model for each request, by the kind of task and how hard it is.

01Set the goal.

Lowest cost, Balanced or Best quality.

02Set the models.

Auto picks only from the models you allow, and never picks one you exclude.

03Cheaper only when it has passed.

A task type starts on the strongest model. It moves to a cheaper one only after that model has passed judged sampled checks.

Router rules: the router's goal and the models it may useRouter rules: the router's goal and the models it may use
Set the router's goal and the models it may use.Demo data
Rules

Blocked,
or detected.

A call that goes through the router is checked before the provider sees it, and can be blocked. Usage that arrives any other way has already happened, so a rule break there can only be detected.

Allowed modelsOnly these models may be used. Empty means all models are allowed.
Blocked modelsThese models may not be used. A rule covers a model and its dated versions.
ProvidersAllow a provider, and only the providers you allow may be used. Or block one.
Blocked data classesCalls carrying these kinds of data are refused. The router looks for email addresses, phone numbers, card numbers and API keys in the prompt.
Size and cost of one callA token limit and a cost limit per request. When several rules set a cap, the tightest one wins.
ScopeAll teams or one team. All environments or one.
It fails closed. If the router cannot read your rules, it refuses the call rather than letting it through.
FAQ

Router and rules,
in short.

Request fields, headers and every error code are in the docs.

Router docs →
01Do my calls have to go through the router?

No. The SDK wraps the client you already use, reads usage from the response it returns and ships it in the background. The router is a separate choice, for when you want routing, fallbacks and caching.

02Whose provider keys does it use?

Free runs on your own provider keys, for the model you name. Paid plans add auto routing, with $25 a month of model spend included.

03Is caching on by default?

No. Caching is off until you turn it on.

04Can a rule stop a call made straight to the provider?

Not on its own. A routed call is checked before the provider sees it and can be blocked. A call made another way has already happened when its usage arrives, so a rule break is detected and you are alerted.

Know who spent it
this week.

Free up to 1M events a month. No card.