An API error is a response with an HTTP status of 400 or higher. It tells you the request could not run and why. The status code gives the category (key, balance, model name, limits), and the message field says exactly what to fix. Read both before retrying.
Errors follow the format of the request: calls to /v1/messages, or requests with an anthropic-version header, get Anthropic-format errors; everything else gets OpenAI-format errors.
OpenAI format:
{
"error": {
"message": "…",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}Anthropic format:
{ "type": "error", "error": { "type": "authentication_error", "message": "…" } }Error code table
| HTTP | When | What to do |
|---|---|---|
400 |
The body is not JSON, model is missing, or the request is invalid for the model |
Fix the request as the message says |
401 |
Missing, wrong or revoked key | Check your key; see Authentication |
402 |
Not enough balance to run the request | Top up or lower max_tokens |
403 |
The key is not allowed to use this model or to call from this IP | Check the key's restrictions in the dashboard |
404 |
No such model (wrong name) or the path does not exist | Look up model names with /v1/models |
429 |
The key's per-minute request limit is exceeded, or the model is overloaded | Wait for the number of seconds in Retry-After, then retry |
500 |
Internal error | Retry; if it keeps failing, send the support ID |
503 |
Maintenance, or the model is temporarily not responding | Retry later; maintenance responses include Retry-After: 60 |
When the model rejects the request content (for example, the context limit is exceeded): non-streaming requests get the original status code and error; streaming requests get an error event in the stream (invalid_request_error) with the error message. See Streaming.
Easy to confuse: 401 vs 403, 402 vs 429
| Code | What it means | How to fix |
|---|---|---|
401 |
The key is not recognized: missing, mistyped or revoked | Send the correct key (Authentication) or create a new one |
403 |
The key is valid but restricted: not allowed to use this model or to call from this IP | Update the key's model or IP list in the dashboard |
402 |
Not enough balance to reserve funds for the request, based on estimated input tokens and max_tokens |
Top up, or lower max_tokens |
429 |
Too many requests per minute, too many concurrent requests, the daily or monthly spending limit you set on the key was reached, or the model is overloaded | Wait for the number of seconds in Retry-After; spending-limit errors include x-should-retry: false, so retrying right away will not help |
Common error messages
Messages are in your account's language. Requests sent without a valid key get English messages when the Accept-Language header starts with en. Values in braces are filled in for each request.
| HTTP | Message |
|---|---|
400 |
The request body must be a JSON object. |
400 |
Missing model name (the "model" field). |
400 |
The maximum number of output tokens is too large. |
401 |
Missing API key. Send your key in the Authorization: Bearer <key> header or the x-api-key header. |
401 |
The API key is invalid or has been revoked. |
402 |
Your balance is too low for this request (about ${amount} needs to be held). Please top up your balance. |
403 |
This API key is not allowed to use the model {model}. |
403 |
This API key cannot be used from IP address {ip}. |
404 |
The model {model} does not exist. See the list at /v1/models. |
404 |
The path {method} {path} does not exist. |
429 |
This API key has reached its limit of {limit} requests per minute. Please try again in {seconds} s. |
429 |
Your account already has {max} requests running at the same time. Please wait for one to finish, then try again. |
429 |
Request rejected because it would exceed the daily spending limit of this API key (${limit}). The key works again from {reopenAt}, or you can raise the limit on the API Keys page. |
429 |
The model is overloaded. Please try again in a few minutes. |
500 |
Something went wrong on our side. Please try again later. Support ID: {requestId} |
503 |
The service is under maintenance. Please try again in a few minutes. |
503 |
The model is temporarily not responding. Please try again later. Support ID: {requestId} |
Error 529 with the Anthropic API
Anthropic's API returns 529 overloaded_error when it is overloaded. GoiAPI never returns 529: an overloaded model returns 429 (type rate_limit_error in the Anthropic format), and a model that is temporarily not responding returns 503 (type overloaded_error). Claude Code and the official SDKs retry both codes automatically. Check each model's status on the Status page.
Support ID
Every response includes an x-request-id header. 500 errors, 503 errors caused by a model not responding, and 400 errors where the model's own message cannot be shown also end with "Support ID: …" in the message (503 errors during maintenance do not). Send this ID to support for a fast lookup.
Am I charged?
A failed request that returns no content is not charged, except a request you cancel yourself. When an error is not caused by your request and no content has been sent to you yet, the request may be retried automatically before the error is returned. Errors caused by the request itself (for example, 400 for an exceeded context) are not retried. See the Refund Policy.