Maniac Docs

Errors

The OpenAI-compatible error envelope and status mapping.

Error envelope

Failures are returned as the standard OpenAI error object — never a bare string — so the openai SDKs parse them directly:

{
  "error": {
    "message": "No model found with id 'foo/bar'.",
    "type": "not_found_error",
    "param": null,
    "code": "model_not_found"
  }
}

Error types

type is one of a closed set:

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, overloaded_error.

Status mapping

StatusWhentype
400Request failed validation, or an unsupported param (e.g. n > 1)invalid_request_error
401Missing or invalid API keyauthentication_error
402Insufficient balance or billing not configuredinvalid_request_error
403API key has no organizationpermission_error
404Unknown model, or a response id not found / not ownednot_found_error
429Rate limit exceeded, or upstream rate limitrate_limit_error
502Upstream provider error, or a missing provider keyapi_error
503A required dependency was unavailable (fail-closed)api_error
500Unhandled errorapi_error

Where applicable the body includes a more specific code (e.g. model_not_found, provider_key_missing, background_unavailable) and a param pointing at the offending field.

Streaming errors

Once a stream has started, the HTTP status is already 200. A later failure is delivered in-band as a terminal error frame (event: error for responses, a data: error object for chat) followed by the stream's end marker, rather than changing the status code.

On this page