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.
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.
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.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.
req_9c21e4team Stagingo1o1 is a blocked model in staging. OpenAI never saw the request.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 →
Change one setting.
The base URL.
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.
A request that names a model gets that model. Send auto and the router picks a model for each request. Paid plans
Every call is metered with exact tokens and cost, and shows the model that answered and why.
# OpenAI SDKs (Python and Node.js) OPENAI_BASE_URL="https://router.tokenspend.net/v1" OPENAI_API_KEY="$TOKEN_METER_KEY"
# Anthropic SDKs (Python and Node.js): no /v1 at the end ANTHROPIC_BASE_URL="https://router.tokenspend.net" ANTHROPIC_API_KEY="$TOKEN_METER_KEY"
import os from openai import OpenAI client = OpenAI( base_url="https://router.tokenspend.net/v1", api_key=os.environ["TOKEN_METER_KEY"], )
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 →
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.
Lowest cost, Balanced or Best quality.
Auto picks only from the models you allow, and never picks one you exclude.
A task type starts on the strongest model. It moves to a cheaper one only after that model has passed judged sampled checks.
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.
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.
Every AI bill,
in one place.
What your team's tools spend, what your customers cost, whether it matches the bill, and what to do about it.