# 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](#messages-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 |
| --- | --- | --- |
| `400` | `invalid_request_error` | `invalid_request_error` |
| `401` | `authentication_error` | `invalid_api_key` |
| `402` | `billing_error` | `insufficient_budget or insufficient_balance` |
| `403` | `permission_error` | `permission_error` |
| `404` | `not_found_error` | `not_found_error` |
| `429` | `rate_limit_error` | `rate_limit_error` |
| `500` | `api_error` | `api_error` |
| `502` | `api_error` | `model_unavailable or api_error` |
| `503` | `overloaded_error` | `api_error` |
| `504` | `timeout_error` | `timeout_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 |
| --- | --- | --- | --- | --- |
| `401` | `invalid_api_key` | The key is missing, invalid, expired or blocked. | No | Check the `Authorization` header and the key under [API keys](https://ewest.ai/keys). Create a new key if it expired or was blocked. |
| `402` | `insufficient_budget` | The key's own budget would be exceeded by this request. This is a 402 on every endpoint, chat included. | No, not until the budget changes | Raise the key's budget, or use another key. See [budget or rate](https://ewest.ai/docs/rate-limits#budget-vs-rate). |
| `402` | `insufficient_balance` | The 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 added | Add funds in the console under Billing, then send the request again. |
| `403` | `permission_error` | The key is not allowed to use this model. | No | Use a model on the key's list, or change the list in the console. |
| `429` | `rate_limit_error` | The key's own limit on requests or tokens per minute (code `rate_limit_exceeded`). Decide by the status `429`. | Yes, with backoff | Wait the seconds in the `retry-after` header, then retry with growing, randomised delays. See [Rate limits and retries](https://ewest.ai/docs/rate-limits). |
| `429` | `rate_limit_error` | This 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-after` | Wait the seconds in `retry-after`, then retry. Your own limits are not the cause. For video and music, submit again later. |
| `500` | `api_error` | An unexpected error on our side. | Yes, a few times | Retry with backoff. If it keeps failing, contact support with the [trace ID](https://ewest.ai/docs/traces). |
| `502` | `model_unavailable or api_error` | The model could not answer right now. This includes a model that was busy, rate limited or too slow behind the scenes. | Yes, with backoff | Retry with backoff. Keep the `x-request-id` if it keeps happening. |
| `503` | `api_error` | Our own service is briefly unavailable. | Yes, with backoff | Retry with backoff. |
| `504` | `timeout_error` | An image or speech request took too long. Chat requests that time out end as `502 model_unavailable` instead. | Yes, once or twice | Retry. For video and music use [jobs](https://ewest.ai/docs/video), 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 |
| --- | --- | --- | --- | --- |
| `400` | `invalid_request_error` | A 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. | No | Fix the parameter named in `param`, and check the model's page for what it accepts. |
| `400` | `invalid_type` | A 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`). | No | Send the kind of value `param` asks for. |
| `400` | `invalid_value` | A 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. | No | Use one of the allowed values named in the message. |
| `400` | `missing_required_parameter` | A 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. | No | Add the field named in `param`. |
| `400` | `unsupported_parameter` | The model does not take that parameter. | No | Remove the parameter, or choose a model that supports it. |
| `400` | `unsupported_value` | The 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). | No | Use one of the listed values, or raise the output limit. |
| `400` | `model_not_supported` | The 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`. | No | Use the endpoint for that kind of model ([Chat](https://ewest.ai/docs/chat), [Images](https://ewest.ai/docs/images), and so on). |
| `400` | `content_policy` | The prompt or input was rejected by the model's safety filters (image and audio endpoints; a job reports it as a failed job, below). | No | Change the prompt or input. |
| `404` | `model_not_found` | No model has that ID. | No | Copy the ID from the [Models](https://ewest.ai/docs/models) page. It starts with `ewest/`. |
| `404` | `not_found_error` | Unknown job ID, or a job that belongs to another key. | No | Check the job ID, and use the key that created the job. |
| `413` | `invalid_request_error` | The request body or an uploaded file is too large. | No | Send a smaller body or file. Uploaded images can be up to 20 MB each and audio files up to 25 MB. [Files](https://ewest.ai/docs/files#limits) lists all the limits. |
| `415` | `invalid_request_error` | The body is not JSON. | No | Send `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](https://ewest.ai/docs/rate-limits#async-jobs) 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](https://ewest.ai/docs/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](https://ewest.ai/docs/traces).

Source: https://ewest.ai/docs/errors
