Skip to content

Spend & limits

Hard caps per key and per account, a live balance, and one-tap top-ups — so a runaway loop can never overspend, and a low balance never surprises you.

You can set a hard spending cap on an individual API key and on the whole account, each as a monthly or daily limit. Both are enforced before a request is dispatched — the key cap is checked first, then the account cap — so a cap is never exceeded, only reached. Set a per-key cap on the API Keys page and the account cap in Billing settings; the current-period spend against each is shown alongside it.

A request blocked by a cap returns HTTP 402 in your surface’s error envelope, with a code that tells you which limit applied. The account-level message reads “account has reached its monthly spend limit”. A zero balance returns 402 with insufficient_credit.

402 · spend cap reached
{
"error": {
"message": "api key has reached its monthly spend limit",
"type": "invalid_request_error",
"code": "spend_limit_exceeded"
}
}
402 · balance exhausted
{
"error": {
"message": "insufficient credit balance",
"type": "invalid_request_error",
"code": "insufficient_credit"
}
}

Your balance is shown in Billing and updates live as requests complete. Set a low-balance threshold to get an in-app banner before you run dry, top up in a tap through Stripe Checkout, and optionally enable auto-recharge so a saved card refills the balance when it dips below your threshold.