Skip to content

DocsGet started

Errors and rate limits

HTTP status codes, the error bodies of the OpenAI and Anthropic formats, retries, keepalives and timeouts.

Error bodies

OpenAI-format endpoints (/v1/chat/completions, /v1/responses, …) answer errors like this:

JSON
{ "error": { "message": "Invalid or missing API key", "type": "invalid_request_error", "param": null, "code": null } }

The Anthropic endpoint (/v1/messages) uses Anthropic's shape:

JSON
{ "type": "error", "error": { "type": "authentication_error", "message": "Invalid or missing API key" } }

Status codes

StatusOpenAI typeAnthropic typeWhat happenedWhat to do
400invalid_request_errorinvalid_request_errorThe body is not valid JSON, or the request does not fit the model (for example the prompt is too long)Fix the request. A too-long prompt reads "prompt is too long: N tokens > M maximum" on /v1/messages
401invalid_request_errorauthentication_errorThe key is missing, wrong or revokedCheck the header and the key
404model_not_foundnot_found_errorSeveral of your instances run different models and none matches modelSend one of the listed model ids, or X-Instance-Id
413request_too_largeThe body is over the limit (64 MiB for chat)Send less, or upload images by URL
429rate_limit_exceededrate_limit_errorOver the key's requests per minuteWait for Retry-After seconds
502upstream_errorapi_errorYour instance did not answerRetry; check the instance page if it repeats
503service_unavailableoverloaded_errorNo instance is running, or it is still starting (the message says which step it is on)Deploy, or wait for Ready; Retry-After: 30 is sent while it starts

Retries

Retry 429, 502 and 503 with backoff, honouring Retry-After. Most SDKs and agents already do. Do not retry 400 and 401 without changing the request.

Long requests and keepalives

Your instance may think for minutes before the first token. So that proxies do not cut the connection:

  • Streaming responses get keepalive comments (: keepalive) in the OpenAI format and ping events in the Anthropic format while the model prefills.
  • Non-streaming responses that take long start with HTTP 200 early and send whitespace until the JSON is ready. If the instance fails after that, the error arrives as the JSON body of that 200 response.

Prefer streaming for anything longer than a few seconds. A single request can run for up to 15 minutes.