Skip to content

Response Object

Represents a complete model response returned when stream: false. Contains the generated output, thread information, and optional metadata.

Properties

success boolean

Always true for successful responses.

thread_id string

The thread ID this response belongs to. Format: thrd_ followed by alphanumeric characters.

response array

The AI-generated response content blocks. Each item is an object with a type field:

  • {"type": "text", "text": "..."} — text response (default for text, plain, and json output modes)
  • {"type": "tool_use", "id": "...", "name": "...", "input": {...}} — pending function call awaiting execution

Access the text content via response[0]["text"]. When stop_reason is "tool_use", process the tool_use blocks and submit results before continuing the conversation.

stop_reason string

Reason the model stopped generating:

  • "end_turn" — Normal completion
  • "tool_use" — Model requested one or more tool calls (check response for tool_use blocks)

response_id string optional

Unique identifier for this response. Can be used with previous_response_id parameter to reset conversation context.

is_summarized boolean

Indicates whether the conversation history was summarized due to context window limits. When true, older messages were compressed to fit within the model's context window.

response_blocks array optional

Structured response blocks when output_mode is set to structured or when tool calls are present. Each block represents a discrete piece of content (text, tool call, tool result).

Show block structure

Each block contains:

type string

Block type. Values: text, tool_call, tool_result.

content string optional

Text content (when type is text).

tool_name string optional

Name of the tool called (when type is tool_call or tool_result).

tool_arguments object optional

Arguments passed to the tool (when type is tool_call).

icon_url string optional

URL of the tool's brand icon (when type is tool_call). Points to a square image (PNG, SVG, or ICO) rendered at 32x32px. Omitted for tools without a brand icon.

tool_result string optional

Result returned by the tool (when type is tool_result).

assistant_id string optional

The assistant ID bound to this thread, if any.

reasoning_content string optional

The model's internal reasoning/thinking process when reasoning is enabled. Contains the chain-of-thought analysis that led to the final response. Only present when using reasoning-capable models with reasoning configuration.

tools object optional

Tool information when include parameter contains tools.available or tools.used.

Show tools structure

available array optional

List of tools that were available to the model during response generation. Present when include contains tools.available.

used array optional

List of tools that were actually called by the model. Present when include contains tools.used.

Each used tool contains:

  • name string - Tool name
  • arguments object - Arguments passed to tool
  • success boolean - Whether execution succeeded
  • result_preview string - Preview of the result (truncated)

rules array optional

List of rules that were applied to this response. Present when include parameter contains rules.

Show rule structure

Each rule contains:

rule_id string

Rule identifier.

name string

Rule name.

priority integer

Rule priority (0-100).

category string optional

Rule category.

annotations array or null optional

Classified image annotations extracted from the response. Each annotation includes relevance classification relative to the response content. Present when the model generates image-related content and annotation processing is enabled. null when no annotations are available.

summary object optional

Conversation summarization details. Present when is_summarized is true, indicating older messages were compressed to fit within the model's context window.

Show summary structure

summary string — The generated summary text.

messages_summarized integer — Number of messages that were summarized.

messages_kept integer — Number of recent messages kept in full.

original_token_count integer — Token count before summarization.

optimized_token_count integer — Token count after summarization.

usage object — Summarization token usage with input_tokens and output_tokens.

usage object optional

Token usage breakdown for this response. Present when include parameter contains usage or all.

Show usage structure

input_tokens integer — Tokens consumed by the input (prompt + history).

output_tokens integer — Tokens generated in the response.

total_tokens integer — Sum of input and output tokens.

cost object optional

Cost information for this response. Present when include parameter contains cost or all.

Show cost structure

response_cost_chf number — Cost of this response in CHF, rounded to 6 decimal places.

context_window integer optional

The model's context window size in tokens. Present when include parameter contains context_window or all.

{
  "success": true,
  "thread_id": "thrd_xyz789",
  "response": [
    {
      "type": "text",
      "text": "The capital of France is Paris. It is located in the north-central part of the country and is known for its art, culture, and iconic landmarks like the Eiffel Tower."
    }
  ],
  "response_id": "resp_abc123",
  "is_summarized": false,
  "stop_reason": "end_turn"
}