Set per-key and per-workspace spending caps in Algerian Dinars to prevent cost overruns.
Not yet available. Workspace budgets are not yet available.
Workspace budgets let owners cap how much any API key — or the workspace as a whole — can spend in a rolling period. Once a budget is exhausted, requests from that key (or workspace) return a 402 insufficient_credits error until the budget resets or is manually increased. This protects against runaway usage, misconfigured loops, and unexpected cost spikes.
| Type | Scope | Description |
|---|---|---|
| Per-key daily | Single key | Resets at midnight UTC each day |
| Per-key monthly | Single key | Resets on the 1st of each month |
| Workspace monthly | All keys combined | Aggregate cap for the whole workspace |
You can set both a per-key budget and a workspace budget. The key budget is a tighter local cap; the workspace budget is a global ceiling. Whichever limit is hit first blocks further requests.
Budgets are configured in the dashboard on each key's settings page, or via the dashboard API.
Budget amounts are entered and displayed in Algerian Dinars (DA). Internally, the gateway tracks consumption in micro-DA (1 DA = 1,000,000 micro-DA) for sub-cent precision, but you never need to work in micro-DA directly.
HTTP 402. The request is rejected before any model is called, so no tokens are billed. The error is indistinguishable at the HTTP level from a low-balance error; your application should handle both the same way.
The X-Balance-Available response header on successful requests reflects the lower of the workspace balance and the key's remaining budget for the current period, so you can monitor headroom proactively.
Once available, you can configure email alerts when a key or workspace reaches 75% and 90% of its budget. Alerts are sent to the workspace owner's email address.
Start with a per-key daily budget during development to cap exploration costs, then switch to a monthly budget for production keys once usage patterns are predictable. Set the workspace monthly budget at 110–120% of your expected monthly spend as a safety net.