Pular para o conteúdo principal

Responses Response


The response object

Represents a response returned by the model in the Responses API, based on the provided input.

id string​

Unique response identifier (e.g., resp-abc123def456).


object string​

The object type, always "response".


created_at integer​

Unix timestamp (in seconds) of the response creation.


status string​

Response status: "completed", "failed", or "in_progress".


model string​

The model used to generate the response.


output array​

List of output items. Each item can be a reasoning item, a message or a function call. On S5 models the reasoning item comes first; to read only the answer text, use output_text in the OpenAI SDK.

reasoning (object)

The model's reasoning (S5 models). The text is confidential and only comes encrypted; on S5-nano (open weights), it comes as plain text in content, with no encrypted_content. Pass the item back on the next call so the model can resume its reasoning. See Reasoning.

  • id (string): Unique item identifier (rs_...).
  • type (string): Always "reasoning".
  • content (array): Empty ([]), except on S5-nano, where it carries the reasoning text:
    • type (string): "reasoning_text".
    • text (string): The reasoning text.
  • encrypted_content (string): Encrypted reasoning. Can only be used by the same account. Absent on S5-nano.
  • summary (array): Reasoning summary, when requested in reasoning.summary; otherwise empty.
    • type (string): "summary_text".
    • text (string): Summary text.
message (object)
  • id (string): Unique message identifier.
  • type (string): Always "message".
  • role (string): Always "assistant".
  • status (string): "completed" or "in_progress".
  • content (array): List of content parts:
    • type (string): "output_text".
    • text (string): Text generated by the model.
    • annotations (array): Annotations (usually empty).
function_call (object)
  • id (string): Unique item identifier.
  • type (string): Always "function_call".
  • name (string): Name of the function to call.
  • arguments (string): Arguments as serialized JSON.
  • call_id (string): Call identifier (used to send the result back).
  • status (string): "completed".

reasoning object or null​

Reasoning configuration used (S5 models). Does not contain the reasoning text.

Show properties
  • effort (string): Effort used (xhigh when not set).
  • summary (string or null): Requested summary type (auto shows up as detailed).
  • context (string): all_turns or current_turn.
  • mode (string): Always "standard".

previous_response_id string or null​

Id of the previous response used in the request, if any.


usage object​

Token usage statistics.

Show properties
  • input_tokens (integer): Tokens consumed in the input.
  • output_tokens (integer): Tokens generated in the output.
  • total_tokens (integer): Total tokens (input + output).
  • input_tokens_details (object or null):
    • cached_tokens (integer): Tokens from cache.
  • output_tokens_details (object or null):
    • reasoning_tokens (integer): Tokens used for reasoning.

error object or null​

Error object when status is "failed".

Show properties
  • code (string): Error code (e.g., "server_error", "internal_error").
  • message (string): Descriptive error message.

incomplete_details object or null​

Details about why the response is incomplete (e.g., reached max_output_tokens).

Show properties
  • reason (string): Interruption reason (e.g., "max_output_tokens").

instructions string or null​

System instructions sent in the request.


temperature float or null​

Sampling temperature used.


top_p float or null​

Top-p used.


max_output_tokens int or null​

Configured token limit.


metadata object​

Request metadata (key-value pairs).


tools array​

Tools that were available to the model.


tool_choice string or object or null​

Tool usage configuration.


parallel_tool_calls boolean​

Whether parallel tool calls were enabled.


store boolean​

Whether the response was stored (default true). Stored responses are available for 30 days for previous_response_id.


Streaming Events​

When stream: true, the API returns events via Server-Sent Events (SSE).

EventDescription
response.createdResponse created
response.in_progressGeneration started
response.output_item.addedNew output item added
response.content_part.addedNew content part started
response.output_text.deltaText fragment generated
response.output_text.doneFull text finalized
response.content_part.doneContent part finalized
response.output_item.doneOutput item finalized
response.reasoning_summary_part.addedNew reasoning summary part started (with reasoning.summary)
response.reasoning_summary_text.deltaReasoning summary fragment
response.reasoning_summary_text.doneReasoning summary finalized
response.reasoning_summary_part.doneReasoning summary part finalized
response.completedResponse complete (with usage)
response.failedError during generation

All events include a sequence_number field incremented with each event.

On S5 models, the reasoning item is the first output item (output_index 0) and already carries encrypted_content in response.output_item.added and response.output_item.done. There are no events with the reasoning text. On S5-nano there is no encrypted_content: the full reasoning text comes in the reasoning item of response.output_item.done (in added, content is empty).


HTTP Error Codes​

StatusDescription
200Success
400Unsupported parameter or invalid request
401Missing or invalid API key
422Validation error
429Rate limit exceeded
500Internal server error

Response Example​

{
"id": "resp-abc123def456",
"object": "response",
"created_at": 1234567890,
"status": "completed",
"model": "sabia-4",
"output": [
{
"id": "msg-def456",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "The capital of Brazil is Brasília.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 8,
"total_tokens": 20,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"temperature": 0.7,
"top_p": 0.95,
"max_output_tokens": null,
"instructions": null,
"metadata": {},
"tools": [],
"tool_choice": "auto",
"parallel_tool_calls": true,
"store": true,
"error": null,
"incomplete_details": null
}

Example with reasoning (S5)​

{
"id": "resp-7c1e9a2b",
"object": "response",
"status": "completed",
"model": "S5",
"output": [
{
"id": "rs_6f1c0d3e",
"type": "reasoning",
"content": [],
"encrypted_content": "gAAAAABp...",
"summary": []
},
{
"id": "fc-abc123",
"type": "function_call",
"name": "get_weather",
"arguments": "{\"city\": \"Campinas\"}",
"call_id": "call_abc123",
"status": "completed"
}
],
"reasoning": {
"effort": "xhigh",
"summary": null,
"context": "all_turns",
"mode": "standard"
},
"previous_response_id": null,
"store": true,
"usage": {
"input_tokens": 52,
"output_tokens": 230,
"total_tokens": 282,
"output_tokens_details": {
"reasoning_tokens": 204
}
}
}

function_call output example​

{
"id": "resp-xyz789",
"object": "response",
"created_at": 1234567890,
"status": "completed",
"model": "sabia-4",
"output": [
{
"id": "fc-abc123",
"type": "function_call",
"name": "get_weather",
"arguments": "{\"city\": \"São Paulo\"}",
"call_id": "call_abc123",
"status": "completed"
}
],
"usage": {
"input_tokens": 25,
"output_tokens": 15,
"total_tokens": 40
}
}

Streaming Example (SSE)​

event: response.created
data: {"type":"response.created","response":{...},"sequence_number":1}

event: response.in_progress
data: {"type":"response.in_progress","response":{...},"sequence_number":2}

event: response.output_item.added
data: {"type":"response.output_item.added","output_index":0,"item":{...},"sequence_number":3}

event: response.content_part.added
data: {"type":"response.content_part.added","item_id":"msg-def456","output_index":0,"content_index":0,"part":{"type":"output_text","text":""},"sequence_number":4}

event: response.output_text.delta
data: {"type":"response.output_text.delta","item_id":"msg-def456","output_index":0,"content_index":0,"delta":"The capital","sequence_number":5}

event: response.output_text.delta
data: {"type":"response.output_text.delta","item_id":"msg-def456","output_index":0,"content_index":0,"delta":" of Brazil","sequence_number":6}

event: response.output_text.done
data: {"type":"response.output_text.done","item_id":"msg-def456","output_index":0,"content_index":0,"text":"The capital of Brazil is Brasília.","sequence_number":7}

event: response.content_part.done
data: {"type":"response.content_part.done","item_id":"msg-def456","output_index":0,"content_index":0,"part":{"type":"output_text","text":"The capital of Brazil is Brasília."},"sequence_number":8}

event: response.output_item.done
data: {"type":"response.output_item.done","output_index":0,"item":{...},"sequence_number":9}

event: response.completed
data: {"type":"response.completed","response":{...,"usage":{"input_tokens":12,"output_tokens":8,"total_tokens":20}},"sequence_number":10}