Errors
The error format depends on the endpoint: /v1/chat/completions responds in OpenAI style, /v1/messages in Anthropic style, and /v1/responses in Responses style. The HTTP status and the machine-readable code error.code are the same on all three.
Format
Section titled “Format”Chat Completions (OpenAI): an error object with the fields code, message, and extra. extra holds the details of the rejection, if there are any.
{ "error": { "code": "model_not_found", "message": "Model 'nope/nope' is not available. Check the model name and try again.", "extra": {} } }/v1/embeddings and /v1/systemone respond in the same format.
Messages (Anthropic): an object with type: "error" and a nested error with the fields type, code, and message. The Anthropic error type is coarse, with several causes mapped to one type, so it comes with a code that has the same value as in the OpenAI format. The details of the rejection, if there are any, are in details.
{ "type": "error", "error": { "type": "not_found_error", "code": "model_not_found", "message": "Model 'nope/nope' is not available. Check the model name and try again." } }Responses: an error object with the fields type, code, and message, plus the optional param and details. details holds the same details as extra in the OpenAI format.
{ "error": { "type": "not_found_error", "code": "model_not_found", "message": "Model 'nope/nope' is not available. Check the model name and try again." } }An API key rejection on /v1/chat/completions and /v1/messages comes in a different, short form; see unauthorized.
| HTTP | code | When |
|---|---|---|
400 | invalid_model, feature_not_supported, provider_bad_request | The request is invalid, or the requested feature is not supported |
400 | model_endpoint_mismatch | The endpoint does not serve this model’s class, see Model classes |
400 | invalid_output_modalities | Unknown output_modalities value in GET /v1/models |
400 | provider_context_length_exceeded | The input does not fit in the model’s context window |
400 | dlp_multi_choice_unsupported | n is greater than 1 in a request with DLP |
401 | authentication_required, invalid_api_key | No API key, or the key is not valid. On /v1/chat/completions and /v1/messages the response has no code, see unauthorized |
402 | insufficient_funds | Not enough funds for the request |
403 | policy_violation | The request is blocked by an access policy |
403 | dlp_violation | The request is blocked by DLP, see Plugins |
403 | provider_forbidden | The model’s provider refused the request because of its content |
404 | model_not_found | The model is not in the catalog |
408 | provider_timeout | The model did not respond in time |
413 | payload_too_large, file_too_large, text_content_too_large | The body, an attachment, or the text is too large, see Limits |
413 | provider_payload_too_large | The provider’s limit for this model is lower than ours, and the request did not fit in it |
422 | validation_error | The request failed validation (for example, model is not in the <provider>/<model> format) |
429 | provider_rate_limited | The model limited the request rate |
429 | api_key_limit_exceeded | The key’s spending limit is reached. The time the counter resets is in extra.reset_at |
500, 502, 503 | internal_service_error | An error on our side |
502 | provider_unavailable, provider_model_down | The model is temporarily unavailable |
503 | service_unavailable | The router is under load. The retry interval is in the Retry-After header |
503 | dlp_policy_unavailable | The DLP policy for the key could not be fetched. The retry interval is in Retry-After |
The waibee/auto model has its own 422 codes (auto_routing_no_match, auto_routing_request_too_large, auto_routing_caching_unavailable, auto_routing_missing_context); see Autorouting.
Messages and Responses types
Section titled “Messages and Responses types”| HTTP | error.type | When |
|---|---|---|
400, 413, 422 | invalid_request_error | The request is invalid or too large |
401 | authentication_error | No API key, or the key is not valid. On /v1/messages the body is short, see unauthorized |
402, 429 | rate_limit_error | Not enough funds, the key’s spending limit is used up, or the model limited the request rate |
403 | permission_error | The request is blocked by an access policy, DLP, or the provider’s moderation |
404 | not_found_error | The model is not in the catalog |
408, 500, 502, 503 | api_error | A model timeout or outage, an internal error, or load |
Exceptions to the table:
- on
/v1/messages, the codeprovider_unavailablecomes asoverloaded_error, and on/v1/responsesasapi_error; invalid_modelcomes asnot_found_error;auto_routing_*anddlp_multi_choice_unsupportedcome asapi_error.
One type covers several causes: permission_error comes for both policy_violation and dlp_violation. So branch on code, not on the type.
The param field on /v1/responses names the parameter that caused the rejection. It is not always present; see Responses format.
What to do
Section titled “What to do”unauthorized
Section titled “unauthorized”401. The API key is missing, wrong, revoked, or expired. The response shape depends on the endpoint. On /v1/chat/completions and /v1/messages, the body is short, {"error":"unauthorized"}, with no code field. On /v1/responses, /v1/embeddings, /v1/systemone, and GET /v1/models, the usual envelope comes back with the code authentication_required (the Authorization header is missing or malformed) or invalid_api_key (the key is not valid). How to pass the key: Authentication.
insufficient_funds
Section titled “insufficient_funds”402. There are not enough funds for the request. Top up your balance; retries will not help. waibee/auto needs a minimum balance; see Autorouting.
model_not_found
Section titled “model_not_found”404. The model is not in your key’s catalog. Check the ID against GET /v1/models; see Models.
validation_error
Section titled “validation_error”422. The request failed validation. message names up to three fields and the reason, for example Invalid request: body.max_tokens: Field required, and the full list is in extra.errors (in details.errors on /v1/messages and /v1/responses). Common causes are a model name without the provider prefix and too many messages or tools. See Limits.
feature_not_supported
Section titled “feature_not_supported”400. The request asks for a feature the router does not provide:
- a provider’s server tool (
web_fetch,code_execution, MCP), see Tool calling; - the
:onlineor:batchsuffix in the model name; waibee/autoon/v1/embeddingsand/v1/systemone;- server-side history storage on
/v1/responses, see Responses format.
The field that caused the rejection comes as param: in extra on Chat Completions, in details on Messages, and directly in error on Responses.
model_endpoint_mismatch
Section titled “model_endpoint_mismatch”400. The model is in the catalog, but this endpoint does not serve its class: an embeddings model on /v1/chat/completions, a chat model on /v1/embeddings, or a decisions model on any endpoint other than /v1/systemone. extra holds model, model_class, and endpoint; on /v1/messages and /v1/responses they are in error.details. Send the request to the endpoint for the class in model_class, or pick a model of the class you need. See Model classes.
invalid_output_modalities
Section titled “invalid_output_modalities”400. output_modalities in GET /v1/models has a value the router does not recognize. The accepted values come in extra.accepted: text, embeddings, decisions, and all. See Filtering by class.
provider_bad_request
Section titled “provider_bad_request”400. The model rejected the request body. If the reason concerns your request, it comes in message: fix the body accordingly, because retrying the same request will not help.
provider_context_length_exceeded
Section titled “provider_context_length_exceeded”400. The input does not fit in the model’s context window. Shorten the history or the attachments, or pick a model with a larger context_length. See Models.
provider_rate_limited
Section titled “provider_rate_limited”429. The model limited the request rate. Retry with exponential backoff, and under sustained load spread it across models. See Limits.
api_key_limit_exceeded
Section titled “api_key_limit_exceeded”429. The key’s spending limit for the period is reached. extra.reset_at holds the time the counter resets, and retries before then are pointless. You need another key or a higher limit.
policy_violation
Section titled “policy_violation”403. The request is blocked by an access policy: for example, the model is not allowed for your group.
dlp_violation
Section titled “dlp_violation”403. DLP blocked the request because it found sensitive data in it. The findings are listed in extra.dlp (in details.dlp on /v1/messages and /v1/responses). See Plugins.
The status is the same as for policy_violation, but the fix is different: the cause is the content of the request, not the key’s permissions. Remove what was found from the request or replace it with a placeholder. Another key will not help.
The check may be broader than what you sent in plugins.dlp, and it may even run without that field: a key can have its own policy, and that policy applies as the minimum. See API key policy.
dlp_policy_unavailable
Section titled “dlp_policy_unavailable”503. The DLP policy for your key could not be fetched, so the request was rejected rather than let through unchecked. Retry after the interval in Retry-After.
payload_too_large
Section titled “payload_too_large”413. The whole request body is too large. The codes file_too_large and text_content_too_large mean that a single attachment or the total text is over the limit. The values are in Limits.
provider_forbidden
Section titled “provider_forbidden”403. The model’s provider refused to process the content of the request, usually because its own moderation flagged it. The refusal concerns the text, not your key or your permissions. Rephrase the request or pick another model.
provider_payload_too_large
Section titled “provider_payload_too_large”413. The request passed our limits but not the provider’s, which is lower for some models. Shorten the input or pick a model with a larger context.
provider_timeout
Section titled “provider_timeout”408. The model did not respond in time. Retry; this happens more often on reasoning models with a high effort level. See Reasoning.
provider_unavailable
Section titled “provider_unavailable”502. The model did not serve the request: it is unavailable or overloaded, it could not be reached, or its response did not match the request. Retry. If the error keeps happening on one model, try another; if it happens on all of them, contact support. provider_model_down means the same thing.
service_unavailable
Section titled “service_unavailable”503. The router is under load. Retry after the interval in the Retry-After header.
internal_service_error
Section titled “internal_service_error”500, less often 502 or 503. An error on our side. Retry the request; if the error keeps happening, contact support and include the value of the x-waibee-trace-id header from the response.
auto_routing_*
Section titled “auto_routing_*”422. Errors in picking a model for waibee/auto, covered in Autorouting.