Skip to content
docs

Responses API

POST /v1/responses accepts requests in Responses format.

For a comparison of the three formats, see the router overview. For how to connect a client and which SDK method to call, see OpenAI-compatible clients.

Terminal window
curl https://api.waibee.com/v1/responses \
-H "Authorization: Bearer $WAIBEE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.1-codex",
"input": "Say hello",
"max_output_tokens": 64
}'

With the official OpenAI SDK:

from openai import OpenAI
client = OpenAI(api_key="sk_live_...", base_url="https://api.waibee.com/v1")
response = client.responses.create(
model="openai/gpt-5.1-codex",
input="Say hello",
max_output_tokens=64,
)
print(response.output_text)

Take model from the shared model catalog, but being in the catalog does not guarantee that a model is available on Responses. If you get feature_not_supported, use /v1/chat/completions.

Chat Completions works with a list of messages. Responses works with items: a message, a function call, a call result, a piece of reasoning. Each has its own type, id, and status.

{
"model": "openai/gpt-5.1-codex",
"input": [
{"type": "message", "role": "user", "content": "What is in the README file?"}
],
"instructions": "Keep your answers short."
}

instructions plays the role of the system prompt and sits at the top level, not inside the list.

The response comes back as an output list of the same items:

{
"id": "resp_0fe6078d9f604fdc8768e83bec097248",
"status": "completed",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "It is the project README."}]
}
],
"usage": {"input_tokens": 14, "output_tokens": 6, "total_tokens": 20}
}

The router issues the response ID. The IDs of the items inside output come from the model. You can send those items back in full.

The router does not store the conversation. Each new request carries the whole conversation in input: what you sent before, plus the items from the previous response’s output, plus the new turn.

{
"model": "openai/gpt-5.1-codex",
"input": [
{"type": "message", "role": "user", "content": "What is in the README file?"},
{"type": "message", "role": "assistant",
"content": [{"type": "output_text", "text": "It is the project README."}]},
{"type": "message", "role": "user", "content": "And in the CHANGELOG?"}
]
}

This has two practical consequences.

The input grows with every turn, and a long session is billed as a series of ever larger requests. Prompt caching softens this: the unchanged beginning of the conversation is billed at a lower price, and the cached share shows in usage.input_tokens_details.cached_tokens.

Fields that ask the server to remember the conversation for you are rejected; the list is below, under What the router does not do.

Declare tools in tools; the call loop lives in the same input items.

{
"model": "openai/gpt-5.1-codex",
"input": [{"type": "message", "role": "user", "content": "What is the weather in Limassol?"}],
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Weather in a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
]
}

The model replies with a function_call item:

{"type": "function_call", "name": "get_weather",
"arguments": "{\"city\":\"Limassol\"}", "call_id": "call_a1"}

You run the call yourself and send the result in the next request, appending both the function_call itself and its output to input:

{
"input": [
{"type": "message", "role": "user", "content": "What is the weather in Limassol?"},
{"type": "function_call", "name": "get_weather",
"arguments": "{\"city\":\"Limassol\"}", "call_id": "call_a1"},
{"type": "function_call_output", "call_id": "call_a1", "output": "+28, clear"}
]
}

call_id links the call to its result. The loop repeats until the model replies with a message.

How the same thing works on the other formats: Tool calling.

The router runs the built-in {"type": "web_search"} tool: the sources it finds arrive in waibee:web_search items alongside the response. The item format, limits, and cost: Web search.

With "stream": true, the response arrives as named events:

event: response.created
data: {"type":"response.created","response":{...}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","delta":"Hel"}
event: response.completed
data: {"type":"response.completed","response":{...,"usage":{...}}}
data: [DONE]

The stream opens with a response.created event. A generation that runs to the end closes it with response.completed or response.incomplete; response.incomplete means the response is incomplete, for example because it hit the max_output_tokens limit or ran out of web search turns. The reason, if given, is in response.incomplete_details.reason. If the generation fails, the last event is error, with the same error object as in a response with an HTTP status. However the stream ends, data: [DONE] follows.

The order of intermediate events depends on the model. Skip event types you do not recognize instead of treating them as errors.

Streaming on the other formats: Streaming.

The format can store conversation history on the server. The router does not, so four fields are rejected with the code feature_not_supported and HTTP 400:

FieldRejected when
storethe value is true
previous_response_idset
conversationset
backgroundthe value is true

An item in the input array with type item_reference is also rejected with HTTP 400 and feature_not_supported, with param set to input. The same applies to an item with id, no role, and type absent or null. Send the full item in input.

{
"error": {
"type": "invalid_request_error",
"code": "feature_not_supported",
"message": "'store' is not supported: this endpoint is stateless. Send the whole conversation in `input`.",
"param": "store"
}
}

The param field names the parameter that got the request rejected. "store": false with none of the other fields is the normal form of a request, and it works.

Reading and deleting a stored response (GET and DELETE on /v1/responses/{id}), canceling a request, and background execution are unavailable for the same reason: they all rely on server-side state.

DLP works here the same way as on the other two formats: you pass the config in the plugins field of the request body, and rules the administrator assigned to your key apply in any case.

Two field names differ, because the format itself names them differently:

In the examples on the Plugins pageHere
messagesinput
a system prompt inside messagesinstructions

A finding names the field you sent: input[0].content or instructions. A string in the input array is named by its index, input[1], and an input sent as a string is named input. When a request is blocked, the findings arrive in error.details.dlp.

In mask mode, response reasoning items and reasoning events keep placeholders. DLP scans their readable text when you send the items back. The rules for reasoning sent back describe which blocks are removed and when a signed block causes 403 dlp_violation.

When DLP removes a signed reasoning item, it strips id from subsequent model items up to the next user, system, or developer message, tool result, or kept reasoning item, which keeps its id. call_id is preserved; built-in tool calls without call_id in that span are removed.

Errors come in Responses’ own format, so client SDKs parse them as usual:

{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "..."
}
}

When streaming, an error arrives as an error event with a body of the same shape, and then the stream closes with data: [DONE].

When the model itself rejects a request, message carries its explanation: what is missing from the body or what should not be there. If the explanation concerns our side rather than your request, a generic string comes instead.

Codes and statuses are shared across all formats: Errors.