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#
| Request | Code |
|---|---|
| Images and any other non-text content in a message | unsupported_content |
n greater than 1 | unsupported_parameter |
logprobs: true | unsupported_parameter |
response_format of type json_object on a model whose supports.json_output is false | unsupported_parameter |
response_format of type json_schema on a model whose supports.json_schema is false | unsupported_parameter |
A response_format that is not text, json_object, or json_schema with a name | unsupported_parameter |
Legacy functions and function_call | unsupported_parameter or unsupported_messages; use tools |
top_p, presence_penalty, frequency_penalty set to anything but their default | unsupported_parameter |
| Any request field OSPP does not know | unsupported_parameter |
| A system message after the conversation has started | unsupported_messages |
A message role other than system, developer, user, assistant, tool | unsupported_messages |
| A decimal number inside a tool definition or a JSON schema | unsupported_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#
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_json | The body is not a JSON object |
| 400 | invalid_messages, invalid_content | messages 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 |
| 400 | unsupported_content, unsupported_messages, unsupported_parameter | See the table above |
| 400 | invalid_parameter | A 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 |
| 400 | invalid_model | model is missing or empty |
| 400 | ambiguous_model | More than one provider offers that plain model name; write provider/model |
| 400 | provider_not_enabled | The 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 |
| 400 | input_schema | The conversation does not fit, for example more than 500 messages after the system messages |
| 404 | model_not_found | OSPP does not know the model; the message lists close names when there are any |
| 400 | invalid_node_name | X-OSPP-Node is not lowercase letters, digits and hyphens, at most 60 characters |
| 400 | invalid_trace | X-OSPP-Trace is not 1 to 120 visible characters without spaces |
| 400 | invalid_store | X-OSPP-Store is not true or false |
| 401 | AUTH, DISABLED | The 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": "..."}} |
| 402 | plan_limit | The plan's executions are used and no balance carries the call; see Finance |
| 402 | insufficient_balance | The balance is too low for the call |
| 403 | reciprocity_ineligible | Your organisation's P2P validation is not eligible at the moment; the message gives the reasons. See under the hood |
| 409 | idempotency_conflict | The Idempotency-Key was used with the same conversation for a different request; see idempotency |
| 409 | self_hosted_gateway | Your organisation is self-hosted and called the Cloud endpoint; use the local proxy |
| 422 | data_policy | The node's data policy masks its inputs and these inputs could not be masked; nothing was sent to the model. See Security |
| 429 | rate_limited, too_many_active_runs | Too many calls per minute, or too many in progress at once, for your organisation. The response has a Retry-After header |
| 502 | run_failed, run_rejected, run_undetermined, run_unknown_provider_outcome, run_expired | The call ended without a passport. The message gives the reason |
| 503 | busy | OSPP as a whole is over its limits. The response has a Retry-After header |
| 504 | run_pending | The 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 anIdempotency-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. typeisinvalid_request_errororapi_erroronly, and there is noRetry-Afterheader.- A call that ended failed or rejected is answered 502 with
run_failedorrun_rejected. Every other call without an answer is answered 504 withrun_and its status at that moment, for examplerun_validatingorrun_unknown_provider_outcome. It is neverrun_pending. - Error responses carry no
X-OSPP-Runheader. - The proxy's own codes are
unauthorized(401, the proxy's token is missing or wrong) andospp_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.
