Skip to main content
organization_spend_quota_exhausted means your organization’s spend limit for the current period has too little room left to start another run. Read this page when runs fail with a 429 and the code names spend.

What happened

Route: POST /v1/runs. An organization can have a spend limit per quota period. The period is the current UTC calendar month. Before each run, OpenType compares the run’s per-request spend ceiling, at most 20,000 micro-USD ($0.02), with the spend left in the period. If the ceiling is larger than what is left, the run is refused. The check uses the ceiling, not the actual cost. A decision run that would cost 19 micros is still refused when fewer than 20,000 micros remain. What is left counts runs in flight: it is the limit minus the larger of settled spend and held spend. Each run holds its full ceiling until it settles, so many concurrent runs can use up the room for a short time. The run was refused before it existed. Nothing was stored and nothing was charged. A replay of an Idempotency-Key that already owns a run is never refused with 429. The message gives both numbers:
A 429 from OpenType always means a period quota refused the run. The response does not say when to retry, so choose your own backoff.

How to fix

  1. Read the quota with GET /v1/quota (needs usage_read). Compare remaining_spend_micros with limits.request_spend_ceiling_micros.
  2. If runs in flight are holding the room, back off and retry. Holds are released as runs settle.
  3. If the period is used up, wait for the next period, which starts at 00:00:00Z on the first day of the next month.
  4. Retry with the same Idempotency-Key. The refused request never created a run.
Keep enough headroom: a run can start only while at least one full ceiling, 20,000 micros, is left in the period.

Example

Checking the room left before sending runs: