Errors

Reference OpenGateway’s JSON error envelopes, emitted HTTP statuses and codes, and next steps for authentication, model, quota, rate-limit, and overload failures.

OpenAI-compatible endpoints return a JSON error body. The status, type, code, and message depend on the failure and endpoint; not every error includes a code or param.

OpenAI-compatible error envelope#

JSON
{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}

error.message explains the failure, error.type identifies its category, and error.code and error.param are optional. Honor a Retry-After response header when present. Codes below are those emitted by the current data plane; upstream passthrough routes can preserve provider-specific statuses or error details.

Common errors#

HTTP statuserror.typeerror.codeMeaningWhat to do
400invalid_request_errormissing_required_parameter or absentA required field is missing or a request parameter is invalid.Fix the body or field named by param; do not retry the same request unchanged.
400invalid_request_errormodel_not_foundThe router cannot find a servable model for this model ID.Copy the exact current ID from GET /v1/models and check that it serves the requested endpoint.
400invalid_request_errorunsupported_endpointThe model exists but does not declare the endpoint being called.Choose a model whose catalog endpoints contains the matching endpoint value.
400image_generation_user_errorProvider-specific or absentAn image-generation request was rejected as a caller error.Review the prompt and image parameters, then retry only after changing the request.
401invalid_request_errorinvalid_api_keyThe API key is missing, invalid, or inactive.Check the key and send it as Authorization: Bearer <key>.
401authentication_errormodel_access_deniedThe key or team is not allowed to use the requested model.Use an allowed model or ask the team owner to review model access.
402insufficient_quotainsufficient_balanceThe key is suspended because the account has no available balance.Add funds on the console Billing page; billing-suspended keys reactivate after the balance is restored.
429rate_limit_errorconcurrency_limit_exceededThis API key has reached its concurrent-request limit for the model. The request is rejected before it is sent upstream.Wait for the Retry-After interval, reduce concurrent requests, then retry.
429budget_exceededbudget_exceededA spending limit set on the Quota page for this key or team has been reached.Wait for the limit period to reset or ask an Owner or Admin to raise the limit. See API keys.
429rate_limit_errorAbsentAn upstream provider rate-limited the request.Retry with backoff or configure a supported fallback.
500internal_server_errorAbsentAn unexpected gateway error or a provider failure hidden by the gateway occurred.Retry cautiously. If it persists, use the request ID and dashboard logs when contacting support.
503server_errorservice_unavailableA model-serving worker or API-key verification service is temporarily unavailable.Honor Retry-After when present, then retry.
503budget_unavailablebudget_unavailableSpending-limit checks are temporarily unavailable, so the request was not sent.Retry after a short delay.
529overloaded_erroroverloadedA supported UltraFast model is overloaded.Honor Retry-After and retry after the indicated interval.

Messages endpoint errors#

POST /v1/messages follows the Anthropic error envelope, not the OpenAI error object:

JSON
{
"type": "error",
"error": {
"type": "overloaded_error",
"message": "The service is temporarily unavailable. Please try again later."
}
}

Messages errors do not include OpenAI code or param fields. Their type and HTTP status use the Messages-specific mapping, so the same failure can have a different status or type than an OpenAI-compatible endpoint. See the Messages reference.

Common Messages statuses and types#

HTTP statuserror.typeerror.codeMeaningWhat to do
400invalid_request_errorAbsentThe request body or parameters are invalid.Fix the request before retrying.
401authentication_errorAbsentThe API key is missing or invalid.Check the key and use Authorization: Bearer <key> or, only for Messages, x-api-key without an Authorization header.
402invalid_request_errorAbsentThe API key is suspended because the account has no available balance.Add funds; billing-suspended keys reactivate after the balance is restored.
403permission_errorAbsentThe request is not permitted.Check access with the team owner.
404not_found_errorAbsentThe requested model or resource was not found.Check the model ID and route.
429rate_limit_errorAbsentA provider rate limit or per-key concurrency limit was reached.Honor Retry-After when present; reduce concurrent requests or retry with backoff.
500api_errorAbsentAn internal or unclassified error occurred.Retry cautiously; contact support if it persists.
503overloaded_errorAbsentThe Messages service is temporarily unavailable.Honor Retry-After when present, then retry.
503api_errorAbsentThe model-serving worker is unavailable.Retry after the service recovers; honor Retry-After when present.
504api_errorAbsentThe upstream request timed out.Retry after a short delay.
529overloaded_errorAbsentA supported UltraFast model is overloaded.Honor Retry-After and retry after the indicated interval.

These are mapped Messages errors. A provider passthrough can preserve its upstream status and error body.

Streaming failures#

Chat Completions streams end with data: [DONE] when they complete normally. If the stream ends unexpectedly, treat the result as incomplete; once output has been sent, the gateway does not switch to another provider mid-stream. See streaming.

See also#

Errors — OpenGateway