Docs

# Errors

Errors keep OpenAI's envelope, so SDKs read them as usual. Platform specifics go under details.

## Error codes

| HTTP | Code | Retry | Meaning |
| --- | --- | --- | --- |
| 400 | invalid_request | no | The request can't be served as sent, or the provider rejected it. |
| 400 | unsupported_parameter | no | A field that can't be dropped safely, such as n greater than 1. |
| 400 | unsupported_feature | no | The model doesn't have a feature the request uses: tools, images, or a response format. |
| 400 | context_length_exceeded | no | The conversation is too long for the model. The wording is the one coding tools recognize, so they compact and retry. |
| 401 | invalid_api_key | no | The key is missing, malformed, or revoked. |
| 401 | api_key_expired | no | The key's expiry has passed. |
| 402 | insufficient_funds | no | Nothing can pay for the request. See below. |
| 403 | account_suspended | no | Inference is paused while the account is under review. |
| 403 | model_not_allowed | no | The key is limited to other models; the message lists them. |
| 404 | model_not_found | no | No model by that name. |
| 429 | subscription_limit_exceeded | no | A subscription window is full, and waiting will help. See below. |
| 429 | key_limit_exceeded | no | The key reached a spend limit its owner set. |
| 429 | upstream_rate_limited | yes | Every provider for the model is rate-limited right now. |
| 500 | internal_error | yes | Something failed on our side. The request costs nothing. |
| 503 | provider_unavailable | yes | No provider can serve the model right now. |

The envelope 

```
{
  "error": {
    "message": "Subscription quota exceeded: the 5-hour limit has 3.2 credits left and this request needs about 12.5. It resets at 2026-09-05T23:00:00Z.",
    "type": "subscription_limit_exceeded",
    "code": "subscription_limit_exceeded",
    "param": null,
    "details": {
      "estimated_credits": "12.50000000",
      "limiting_windows": [
        "five_hour"
      ],
      "subscription_available_credits": "3.20000000",
      "resets_at": "2026-09-05T23:00:00Z",
      "prepaid_available_credits": "0.00000000",
      "prepaid_fallback_enabled": false
    }
  }
}
```

## When nothing can pay

`429 subscription_limit_exceeded` means your subscription's 5-hour or weekly window is full but will reset before the subscription ends. `Retry-After` and `details.resets_at` say when.

`402 insufficient_funds` means waiting won't help: the monthly allowance is spent, or there's no subscription and prepaid credits are short. Top up, or turn on prepaid fallback in Billing.

Both send `x-should-retry: false`, so SDKs don't retry them on their own.

## Failed requests are free

A request that fails, is cancelled, or is rejected for its length is charged zero.
