Response format
Output types
output is an array of items in the order the assistant acted. A typical reply: a few tool_call items in a row, then a final text.
Each output item is discriminated by its type field. The order matches what the assistant did.
real-world output
[
{
"type": "tool_call",
"tool_call": {
"name": "get_current_weather",
"input": { "latitude": 55.75, "longitude": 37.62 },
"output": { "type": "content", "content": [{ "type": "text", "text": "{\"temp\":12}" }] },
"cost": 0
}
},
{ "type": "text", "text": "It's +12°C in Moscow right now…" }
]
text
{ "type": "text", "text": "Here is my answer…" }
file
Appears when the assistant generated a file (an image, for example).
{
"type": "file",
"file": { "id": "88", "name": "generated_image.png", "mime_type": "image/png" }
}
Build the download link from the storage base URL.
tool_call
A tool call together with its result. On success:
{
"type": "tool_call",
"tool_call": {
"name": "get_current_weather",
"input": { "latitude": 55.75, "longitude": 37.62 },
"output": { "type": "content", "content": [{ "type": "text", "text": "…" }] },
"cost": 0
}
}
When the tool fails, output.type becomes error:
"output": { "type": "error", "error": { "message": "Request timeout", "reason": "fetch_timeout" } }
What specific tools return is covered in Tool responses.
search
Appears when the provider is Perplexity (web search is built into the model).
{
"type": "search",
"search": {
"results": [{ "title": "…", "url": "…", "snippet": "…", "source": "…" }],
"citations": ["https://…"],
"images": [{ "title": "…", "image_url": "…", "origin_url": "…" }]
}
}
custom
Provider-specific data.
{ "type": "custom", "custom": { "from": "perplexity", "content": { … } } }
Thinking doesn't end up in output
Extended thinking blocks appear only in messages
as { "type": "thinking", … }, never in output.