Skip to main content
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:
If the run estimate is larger than the tokens remaining, the run is refused. 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

  1. Read the quota with GET /v1/quota (needs usage_read). remaining_tokens is what is left in the period.
  2. Lower max_output_tokens to what the answer needs. A decision run usually needs very few output tokens; the example in the quickstart uses 16.
  3. Shrink the input: trim the state or prompt, and shorten the questions or schema.
  4. 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.
  5. Retry with the same Idempotency-Key. The refused request never created a run, so the key is still free, even after you lower max_output_tokens or trim the input.

Example

Checking the tokens left before sending a run: