429.
How budget enforcement works
The Lua script is atomic — no race condition between checking and decrementing, even across multiple gateway replicas. This is the only place budget is enforced; there is no secondary check elsewhere.Budget granularity
Key budget is the most common control. User limits let you cap a person’s total spend across all the keys they own. There is no separate tenant/org-wide budget tier — these two levels are checked independently, and a request is blocked if either is exceeded.
Budget increase requests
Developers can request a budget increase directly from MY LANE. Managers approve or deny requests; approved increases apply immediately and optionally expire at a set date — when they expire, the limit reverts to the baseline.Over-budget response
When a request is blocked by a budget:Spend tracking
Actual spend is committed to Redis after a successful response — using the real token counts from the provider, not the estimate used for admission. The dashboard reflects real spend, not estimates. The ClickHouseusage_events table records every request with its cost breakdown:
input_cost_usdoutput_cost_usdcache_creation_cost_usd(for Anthropic prompt caching)cache_read_cost_usd
Budget alerts
Configure a webhook alert at a spend threshold (e.g., 80% of budget) in Console → Webhooks. The event isbudget.threshold_reached.
See POST /v1/webhook-endpoints for the webhook payload format.