# Troubleshoot a request

A short checklist for when a request fails: what to check first, and what to send support.

Work down this list in order. Most failures are one of the first four. [Errors](https://ewest.ai/docs/errors) has every status and code in detail.

## 1. Read the status and code

Look at the HTTP status and the `code` or `type` in the body, not the message wording. `4xx` (except `429`) means something about the request, key or account needs to change; `5xx` and `429` can succeed on a retry. Check every event of a stream too: a failure after the answer starts arrives as an event, not a status ([errors inside a stream](https://ewest.ai/docs/errors#streams)).

## 2. Check the key and the base URL

- `401`: the key is missing, mistyped, expired or blocked. Send it as `Authorization: Bearer sk-…` (or `x-api-key` for Anthropic clients) and copy it again from [API keys](https://ewest.ai/keys).
- OpenAI libraries and tools use the base URL `https://api.ewest.ai/v1`. The Anthropic libraries and Claude Code use `https://api.ewest.ai` **without** `/v1`, because they add `/v1/messages` themselves.
- Set only one key variable in a tool. If a tool still fails, send the same request with cURL: it uses the same key and model without the tool.

## 3. Check the model

- `404 model_not_found`: the ID must start with `ewest/` and be listed under [Models](https://ewest.ai/docs/models).
- `400 model_not_supported`: the model is the wrong type for the endpoint, for example a video model sent to chat.
- `403 permission_error`: your key is limited to a list of models that does not include this one. Change the list in the console.
- `400 unsupported_parameter` or `unsupported_value`: this model does not take that parameter or value. `param` names it.

## 4. Check the budget and balance

`402 insufficient_budget` means the key's own budget is used up: raise it or use another key. `402 insufficient_balance` means the organisation's prepaid balance is too low: add funds under Billing. See [budget or rate](https://ewest.ai/docs/rate-limits#budget-vs-rate).

## 5. Rate limits and busy models

On `429`, wait the seconds in the `retry-after` header and retry with growing, randomised delays. A `429` with code `model_busy` is not your rate limit: that model is busy right now, so the same wait-and-retry applies. On `502`, `503` and `504` the model or the service was briefly unavailable: retry with backoff. If it keeps failing, check [status.ewest.ai](https://status.ewest.ai). See [Rate limits and retries](https://ewest.ai/docs/rate-limits).

## 6. Video and music jobs

A job that cannot finish ends with `status: "failed"` and an `error.code`; it is not an HTTP error and is not charged. Read the code under [Failed jobs](https://ewest.ai/docs/errors#jobs), change the input if it says so, and submit a new job.

## 7. Still stuck? Send support the trace ID

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 the same ID. Send it with the endpoint, the model and the time. Never send your API key. See [Trace IDs](https://ewest.ai/docs/traces).

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