doteb
Resources

Error Handling

How doteb returns errors in an OpenAI-compatible format on the OpenAI-compatible endpoints.

Error Handling

On the OpenAI-compatible endpoints, doteb returns errors in the same format as the OpenAI API, so existing OpenAI SDKs and tooling can parse gateway errors without changes. This applies to errors forwarded from upstream providers as well as errors raised by the gateway itself (authentication failures, usage limits, validation problems, timeouts, and so on). The Anthropic-compatible Messages endpoint (/v1/messages) instead returns Anthropic-native errors — see Anthropic Endpoint below.

Error Format

Errors on the OpenAI-compatible endpoints (/v1/chat/completions, /v1/embeddings, /v1/images, /v1/models, /v1/moderations, /v1/responses, /v1/videos) use the standard OpenAI error envelope:

{
	"error": {
		"message": "Unauthorized: doteb API key reached its usage limit.",
		"type": "invalid_request_error",
		"param": null,
		"code": "invalid_api_key"
	}
}
FieldDescription
error.messageHuman-readable description of what went wrong.
error.typeHigh-level error category (see the table below).
error.paramThe request parameter that caused the error, or null when not parameter-specific.
error.codeA more specific machine-readable code, or null when no specific code applies.

The HTTP status code on the response always matches the error and is the authoritative signal — read it from the response status line rather than the body.

Status Codes

The gateway maps HTTP status codes to OpenAI error types and codes as follows:

Statustypecode
400invalid_request_error(varies / null)
401invalid_request_errorinvalid_api_key
402invalid_request_errorbilling_error
403invalid_request_errorpermission_denied
404invalid_request_errornot_found
408timeout_errortimeout
413invalid_request_errorrequest_too_large
415invalid_request_errorunsupported_media_type
429rate_limit_errorrate_limit_exceeded
499invalid_request_errorrequest_cancelled
504timeout_errortimeout
5xxapi_error(null)

Validation errors raised before a request reaches a provider often include a more specific code and a param pointing at the offending field — for example invalid_json, model_not_found, or unsupported_parameter_combination.

Streaming Errors

For streaming requests ("stream": true), an error that occurs after the stream has started is delivered as an SSE error event whose payload uses the same { "error": { ... } } envelope. Errors that occur before streaming begins (such as authentication failures) are returned as a normal JSON error response with the appropriate status code.

Anthropic Endpoint

The Anthropic-compatible Messages endpoint (/v1/messages) returns errors in Anthropic's native format instead, so the Anthropic SDK can parse them:

{
	"type": "error",
	"error": {
		"type": "authentication_error",
		"message": "Unauthorized: invalid API key."
	}
}
  • Rate Limits — details on 429 responses and rate limit headers.

How is this guide?

Last updated on

On this page

Ready for production?

Ship to production with SSO, audit logs, spend controls, and guardrails your security team will approve.

Explore Enterprise