TrustedRouter / Routing controls
LLM API Spend Controls
Set daily, weekly, and monthly API key budgets. Opt into strict estimated-cost admission to count in-flight requests, with clear speed tradeoffs.
Give each application a budget.
Create separate keys for a customer, project, or agent. Set daily, weekly, monthly, and lifetime USD limits. Keep your application budgets visible alongside request tags and cost allocation.
Ordinary spending windows use approximate checks. For concurrent workloads, opt into budget_strict to include outstanding request estimates in admission decisions.
An opt-in project budget
{
"name": "Research agent",
"limit_daily": 5,
"limit_monthly": 100,
"budget_strict": true
}Create this key with a management key. Strict mode is off by default and fixed when the key is created.
Account for work already in flight.
Strict admission counts reserved estimates alongside settled spend in enforced windows. Settlement and refunds release the corresponding holds. A window reset keeps outstanding holds counted until the request finishes.
This controls estimated-cost admission. Final provider usage can exceed an estimate, so an absolute final-charge ceiling would be the wrong promise.
Choose the tradeoff deliberately.
Strict mode can be much slower: authorization goes through a shared counter rather than approximate snapshots or local leases. Admission concurrency and database work are bounded to protect the service.
Exhausted windows return 429. Busy strict admission returns retryable 503. The guide explains reset headers and backoff.