organization_token_quota_exhausted means your organization’s token limit for the current period has too few tokens left for this run. Read this page when runs fail with a 429 and the code names tokens.
What happened
Route:POST /v1/runs.
An organization can have a token limit per quota period. The period is the current UTC calendar month. Before each run, OpenType estimates the tokens the run could use and compares that with the tokens left:
max_output_tokens counts in full, even when the answer turns out shorter.
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
- Read the quota with
GET /v1/quota(needsusage_read).remaining_tokensis what is left in the period. - Lower
max_output_tokensto what the answer needs. A decision run usually needs very few output tokens; the example in the quickstart uses 16. - Shrink the input: trim the
stateor prompt, and shorten the questions or schema. - 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.
- Retry with the same
Idempotency-Key. The refused request never created a run, so the key is still free, even after you lowermax_output_tokensor trim the input.
Example
Related
- Spend limits and quotas - period limits and
GET /v1/quota. - organization_spend_quota_exhausted - the spend side of the same period quota.
- input_too_large - how the input estimate is computed and capped.
- Problem codes - every code, its status, and whether a retry can help.