Documentation › The endpoint

Errors

Errors use OpenAI's error shape, so existing clients surface the message. This page lists what the endpoint refuses and the codes it answers with.

The error shape#

{
  "error": {
    "message": "messages[1]: only text content can be certified through this endpoint for now",
    "type": "invalid_request_error",
    "param": "messages[1].content",
    "code": "unsupported_content"
  }
}

message says in plain words what is wrong. param names the field when there is one, otherwise it is null. code is stable and meant for your code to branch on. type follows OpenAI: invalid_request_error for a request that cannot be served, insufficient_quota (402), rate_limit_exceeded (429), api_error for status 500 and above. A 401 is not in this shape; see the codes table below.

OSPP refuses a request field it cannot serve as asked, and never answers with another model. Inside a message only role, content, tool_calls and tool_call_id are used; other fields of a message, such as name, are not passed to the model.

What is refused#

RequestCode
Images and any other non-text content in a messageunsupported_content
n greater than 1unsupported_parameter
logprobs: trueunsupported_parameter
response_format of type json_object on a model whose supports.json_output is falseunsupported_parameter
response_format of type json_schema on a model whose supports.json_schema is falseunsupported_parameter
A response_format that is not text, json_object, or json_schema with a nameunsupported_parameter
Legacy functions and function_callunsupported_parameter or unsupported_messages; use tools
top_p, presence_penalty, frequency_penalty set to anything but their defaultunsupported_parameter
Any request field OSPP does not knowunsupported_parameter
A system message after the conversation has startedunsupported_messages
A message role other than system, developer, user, assistant, toolunsupported_messages
A decimal number inside a tool definition or a JSON schemaunsupported_parameter; use whole numbers or strings

Which models support JSON output and JSON schemas is in GET /models; see models.

The fields user, metadata, store, service_tier and stream_options are accepted and not passed to the model, except that stream_options.include_usage is honoured on a stream.

Codes#

StatusCodeMeaning
400invalid_jsonThe body is not a JSON object
400invalid_messages, invalid_contentmessages is missing, empty or malformed; there is no user or assistant turn; a tool message without tool_call_id; tool turns in a call that declares no tools
400unsupported_content, unsupported_messages, unsupported_parameterSee the table above
400invalid_parameterA value out of range, for example temperature outside 0 to 2 or not in steps of 0.1, max_tokens not a positive whole number, stop with more than 4 strings, tool_choice without tools, a malformed tool definition
400invalid_modelmodel is missing or empty
400ambiguous_modelMore than one provider offers that plain model name; write provider/model
400provider_not_enabledThe model's provider is not enabled for your organisation, or the name starts with a provider OSPP does not list; GET /models lists what you can call
400input_schemaThe conversation does not fit, for example more than 500 messages after the system messages
404model_not_foundOSPP does not know the model; the message lists close names when there are any
400invalid_node_nameX-OSPP-Node is not lowercase letters, digits and hyphens, at most 60 characters
400invalid_traceX-OSPP-Trace is not 1 to 120 visible characters without spaces
400invalid_storeX-OSPP-Store is not true or false
401AUTH, DISABLEDThe API key is missing or not valid, or the organisation was disabled. This answer is not in OpenAI's shape: the body is {"detail": {"code": "AUTH", "message": "..."}}
402plan_limitThe plan's executions are used and no balance carries the call; see Finance
402insufficient_balanceThe balance is too low for the call
403reciprocity_ineligibleYour organisation's P2P validation is not eligible at the moment; the message gives the reasons. See under the hood
409idempotency_conflictThe Idempotency-Key was used with the same conversation for a different request; see idempotency
409self_hosted_gatewayYour organisation is self-hosted and called the Cloud endpoint; use the local proxy
422data_policyThe node's data policy masks its inputs and these inputs could not be masked; nothing was sent to the model. See Security
429rate_limited, too_many_active_runsToo many calls per minute, or too many in progress at once, for your organisation. The response has a Retry-After header
502run_failed, run_rejected, run_undetermined, run_unknown_provider_outcome, run_expiredThe call ended without a passport. The message gives the reason
503busyOSPP as a whole is over its limits. The response has a Retry-After header
504run_pendingThe call did not finish in time. It may still finish; the message names the run id and GET /v1/runs/{run_id} reads it later

Other codes can occur for conditions of an organisation's own setup. Branch on the status and treat an unknown code like its status class.

Calls that are held#

A call that a monitor's finding holds, or that is halted on a log conflict, has not ended. If the model had already answered, you receive the answer with a pending passport, and the passport stays pending while the call is held. If it had not, the endpoint answers 504 run_pending when its wait runs out. Read the call later with GET /v1/runs/{run_id} or find it on the Platform.

Errors on a stream#

A refused request gets a normal JSON error, not a stream. An answer-first stream that has started and then fails carries one event with an error object and the run id, followed by data: [DONE]. See streaming.

Retrying#

  • 400, 404, 409, 422: do not retry unchanged; fix the request.
  • 429, 503: wait for Retry-After, then retry. OpenAI clients do this by themselves.
  • 502, 504: an error response for a call that was started carries X-OSPP-Run. A plain retry makes a new call. To retry without making a second call, send an Idempotency-Key; see idempotency.

Errors from the model's provider#

When the provider refuses or fails, the call ends without a passport and you receive a 502 with the reason in the message.

Self-hosted#

Through the local proxy the error shape is the same, with these differences:

  • A call that was refused when it started carries OSPP's own code in capitals: PLAN_LIMIT, RATE_LIMITED, TOO_MANY_ACTIVE_RUNS, BUSY, IDEMPOTENCY_CONFLICT, RECIPROCITY_INELIGIBLE.
  • type is invalid_request_error or api_error only, and there is no Retry-After header.
  • A call that ended failed or rejected is answered 502 with run_failed or run_rejected. Every other call without an answer is answered 504 with run_ and its status at that moment, for example run_validating or run_unknown_provider_outcome. It is never run_pending.
  • Error responses carry no X-OSPP-Run header.
  • The proxy's own codes are unauthorized (401, the proxy's token is missing or wrong) and ospp_unreachable (502).

Other routes#

The codes above are those of POST /chat/completions. The other routes of the API, such as the outcome address and GET /v1/runs/{run_id}, answer errors as {"detail": {"code": "...", "message": "..."}} with codes in capitals.