Error codes and rate limits

Last updated:

On this page

Error codes

CodeDescription
400Invalid request — e.g. prompt + max_tokens exceeds the model's context window
401Invalid or missing API key
429Token limit exceeded or all slots busy
503Model temporarily unavailable

A 429 response includes details about the window and when quota is reclaimed, plus a Retry-After header:

json
{
  "detail": {
    "message": "Daily token limit exceeded",
    "window": "daily",
    "tokens_used": 250000,
    "tokens_limit": 250000,
    "retry_after_seconds": 3600,
    "reset_at": "2026-08-30T00:00:00+00:00"
  }
}

Handle 429 and 503 with backoff

Both are transient. Respect the Retry-After header (or retry_after_seconds) and retry — for 429, quota is continuously reclaimed (rolling hourly windows) or resets at midnight UTC (daily limits), see Plans and quotas.

Rate limit headers

Every response includes headers showing your current token usage:

HeaderDescription
X-RateLimit-Limit-TokensToken limit for the period
X-RateLimit-Used-TokensTokens used
X-RateLimit-Remaining-TokensTokens remaining

Token warnings

  • At 80% of the quota a warning field is included in the API response
  • At 90% a warning email is sent (max one per day)

Track your consumption in real time via GET /v1/usage or in the dashboard.