Skip to content

Type to search the docs and the model list.

Errors

What each error means, whether to retry, and what to do.

Errors use the OpenAI shape: {"error": {"message", "type", "code", "param"}}. code is the HTTP status as a string unless a more specific one applies (for example model_not_found), and param names the field at fault when there is one. The one exception is the Anthropic Messages endpoints (/v1/messages and /v1/messages/count_tokens), which use Anthropic's envelope.

Branch on the HTTP status and the stable type or code, never on message. Messages are written for people and can change wording at any time.

Errors on the Messages endpoints

The status codes, code and param are the same everywhere, but /v1/messages and /v1/messages/count_tokens wrap the error the way Anthropic does, so the Anthropic libraries read it: {"type": "error", "error": {"type", "message", "code", "param"}, "request_id": "..."}. Only error.type changes, to Anthropic's name for the status. code and param stay inside error (the libraries ignore them), so model_not_found and param: model work as on the other endpoints. request_id is the same as the x-request-id header.

Status, Messages endpoints, Other endpoints
StatusMessages endpointsOther endpoints
400invalid_request_errorinvalid_request_error
401authentication_errorinvalid_api_key
402billing_errorinsufficient_budget or insufficient_balance
403permission_errorpermission_error
404not_found_errornot_found_error
429rate_limit_errorrate_limit_error
500api_errorapi_error
502api_errormodel_unavailable or api_error
503overloaded_errorapi_error
504timeout_errortimeout_error

On the Messages endpoints branch on the status, or on code for the specific cases such as insufficient_budget. The rest of this page uses the OpenAI-style types; read it together with the table above when you call /v1/messages.

Request errors

These are about the key, the account or the service, not about what you sent. The same request can succeed later, after you change the key or the account, or after a short wait.

Status, Type, Meaning, Retry?, What to do
StatusTypeMeaningRetry?What to do
401invalid_api_keyThe key is missing, invalid, expired or blocked.NoCheck the Authorization header and the key under API keys. Create a new key if it expired or was blocked.
402insufficient_budgetThe key's own budget would be exceeded by this request. This is a 402 on every endpoint, chat included.No, not until the budget changesRaise the key's budget, or use another key. See budget or rate.
402insufficient_balanceThe organisation's prepaid balance is too low for this request. Only returned when prepaid billing is enforced for your account.No, not until funds are addedAdd funds in the console under Billing, then send the request again.
403permission_errorThe key is not allowed to use this model.NoUse a model on the key's list, or change the list in the console.
429rate_limit_errorThe key's own limit on requests or tokens per minute (code rate_limit_exceeded). Decide by the status 429.Yes, with backoffWait the seconds in the retry-after header, then retry with growing, randomised delays. See Rate limits and retries.
429rate_limit_errorThis model is busy right now (code model_busy, with a retry-after header). Some models run on a limited number of machines; over that limit a request is turned away at once instead of waiting.Yes, after retry-afterWait the seconds in retry-after, then retry. Your own limits are not the cause. For video and music, submit again later.
500api_errorAn unexpected error on our side.Yes, a few timesRetry with backoff. If it keeps failing, contact support with the trace ID.
502model_unavailable or api_errorThe model could not answer right now. This includes a model that was busy, rate limited or too slow behind the scenes.Yes, with backoffRetry with backoff. Keep the x-request-id if it keeps happening.
503api_errorOur own service is briefly unavailable.Yes, with backoffRetry with backoff.
504timeout_errorAn image or speech request took too long. Chat requests that time out end as 502 model_unavailable instead.Yes, once or twiceRetry. For video and music use jobs, which have no such limit on the request.

Model and validation errors

These say the request itself is the problem. Sending the same request again returns the same error, so fix it first.

Status, Type or code, Meaning, Retry?, What to do
StatusType or codeMeaningRetry?What to do
400invalid_request_errorA parameter is missing, has the wrong type or is out of range. param names it. A missing model has code missing_required_parameter on chat/completions, completions, messages, responses and rerank; other endpoints still use code 400 for it.NoFix the parameter named in param, and check the model's page for what it accepts.
400invalid_typeA field has the wrong kind of value, such as response_format that is not an object. param names it with dots (for example response_format.json_schema.schema).NoSend the kind of value param asks for.
400invalid_valueA field has a value that is not allowed, such as a response_format.type other than text, json_object or json_schema, or a schema name that is not 1 to 64 letters, digits, underscores or dashes.NoUse one of the allowed values named in the message.
400missing_required_parameterA required field is missing. For structured output, json_schema needs both a name and a schema (chat: response_format.json_schema.*; Responses: text.format.*). A missing model has this code too.NoAdd the field named in param.
400unsupported_parameterThe model does not take that parameter.NoRemove the parameter, or choose a model that supports it.
400unsupported_valueThe model does not take that value. For reasoning_effort (Responses: reasoning.effort) the message lists the supported efforts, which are also in the model's reasoning_efforts in GET /v1/models. On Claude Haiku 4.5 it is also returned when max_tokens is too small for the effort; the message names the smallest that works: 1025 for low, 1366 for medium and high (only ewest/claude-haiku; on /v1/messages it takes no output_config.effort at all).NoUse one of the listed values, or raise the output limit.
400model_not_supportedThe model is the wrong type for this endpoint, such as a video model on the chat endpoint, whatever models the key is limited to. This is checked before the model runs and covers every endpoint, including embedding and image models sent to a chat endpoint. A wrong-type model listed in models is the same error with param: models.NoUse the endpoint for that kind of model (Chat, Images, and so on).
400content_policyThe prompt or input was rejected by the model's safety filters (image and audio endpoints; a job reports it as a failed job, below).NoChange the prompt or input.
404model_not_foundNo model has that ID.NoCopy the ID from the Models page. It starts with ewest/.
404not_found_errorUnknown job ID, or a job that belongs to another key.NoCheck the job ID, and use the key that created the job.
413invalid_request_errorThe request body or an uploaded file is too large.NoSend a smaller body or file. Uploaded images can be up to 20 MB each and audio files up to 25 MB. Files lists all the limits.
415invalid_request_errorThe body is not JSON.NoSend Content-Type: application/json with a JSON body.

Failed jobs

A video or music job that cannot finish is not an HTTP error. The job ends with status: "failed" and an error object holding a code (generation_failed when the model failed to generate, or for example content_policy or timeout) and a fixed message. A failed job is not charged. To try again, submit a new job; see Rate limits and retries for how to avoid double submits. A job you stop with POST /v1/jobs/{id}/cancel before it starts ends the same way, with code cancelled; once a job has started it can no longer be cancelled (409 job_running) and finishes as usual.

Errors inside a stream

Problems found before the answer starts come back as a normal HTTP error. Once a streamed answer has begun the status is already 200, so a later failure arrives as an event in the stream, and then the stream ends. Check every event for an error instead of relying on the status. Streaming shows how to read a stream.

  • Chat completions: a final chunk has finish_reason: "error" and an error object with message, type (model_error) and code.
  • Anthropic Messages: an event: error whose data is {"type": "error", "error": {"type": "api_error", "message": ...}}.
  • Responses: an event: error with code: "model_error" and a message.
  • Text you already received stays valid. To try again, send the whole request again; the model does not pick up where it stopped.
  • Chat responses have to start within about 90 seconds, which is another reason to stream long answers. Image and audio models have their own time limits, and no response can take longer than 100 seconds to start.

Trace IDs

Every response, errors included, has an x-request-id header. Keep it when you log a failure: you can find the request in Console → Requests, and support can use it too. See Trace IDs.