Skip to content
Rapid Router
Guides · Cost and budgets

Budgets

Cap spend per key, per account and per workspace, and the error a request gets once a cap is hit.

Four ceilings, each checked before every request, so a runaway loop or a leaked key stops at a number you chose. They count billed spend in US dollars. A request already running when a ceiling is crossed finishes; the next one is refused, and nothing is billed for the refusal.

Key monthly cap
one key; resets on the 1st of the month (IST)
402 key_cap_reached
Key limit
one key; resets daily, weekly or monthly (UTC), or never: a lifetime limit
402 key_limit_reached
Account budget
every key on the account; resets by UTC day, ISO week and calendar month
403 budget_exceeded
Workspace budget
every key in the workspace; resets daily, weekly, monthly, or never: lifetime
403 workspace_budget_exceeded

Per key. Set the cap and the limit in the dashboard's key editor, or in code through the Provisioning API with monthly_cap_usd, limit_usd and limit_reset (daily, weekly, monthly, or null for a lifetime limit). That is how you hand each customer or side project a key that cannot spend more than its share.

curl https://rapidrouter.ai/api/v1/provisioning/keys \
  -H "Authorization: Bearer sk-rr-mgmt-..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer-42", "limit_usd": 10, "limit_reset": "monthly" }'

# GET /provisioning/keys/:id reports limit_spent_usd,
# limit_remaining_usd and limit_resets_at.

Per account and workspace. The account budget covers spend from every key you own; a budget your organisation set for you can only be changed by its owner or an admin, and PUT /budget answers 403 managed. A workspace's budgets are set under Workspaces in the dashboard and cover the keys in that workspace.

Being told. When a key limit or the account budget is hit, your webhook gets a key.limit_reached or budget.exceeded event. To hear before a ceiling rather than at it, set spend alerts.