How to size a first budget, choose block or warn, and read the alerts.
Setting budgets that hold
A budget is only useful if it is set before the surprise. This guide covers the three decisions every budget needs.
1. What it applies to
Put a budget on a project when several services share one feature's cost, and on a key when one service could misbehave on its own, such as a batch job or an agent that calls models in a loop. A key budget and a project budget can both apply; the first one reached takes effect.
2. How big
For a new feature, start from the last two weeks of spend in the request log, double it, and round up. Revisit after a month. A budget that triggers every week is noise; one that never comes close is not protecting anything.
3. Block or warn
- Block suits background work: batch jobs, evaluations, internal tools. A blocked call returns a clear error that your code can catch.
- Warn suits customer-facing features, where a failed request costs more than the tokens. Pair it with an alert to someone who can act the same day.
Creating one through the API
POST /v1/budgets
{"name": "nightly-evals", "limit_eur": 120, "period": "weekly"}
name, limit_eur and period are required. New budgets block at the limit unless you change them in the dashboard.
Reading the alerts
Alerts fire at 50%, 80% and 100%. The 80% alert includes the projected spend for the rest of the period at the current rate, which is usually the number to act on.