Skip to main content
Wardin enforces budgets atomically in Redis before forwarding a request to any provider. A request over budget never reaches the provider — it’s blocked at the gateway with a structured 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:
For CI / headless clients the response is always structured JSON — no HTML error pages.

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 ClickHouse usage_events table records every request with its cost breakdown:
  • input_cost_usd
  • output_cost_usd
  • cache_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 is budget.threshold_reached. See POST /v1/webhook-endpoints for the webhook payload format.