Response format
Multi-turn conversations
To continue a conversation, pass the previous turns in the turns[] array. Each turn is built from the request’s input and the response’s output/messages.
Building a turn
Once you have the result, take the task’s turn as a whole (it already contains input,
output, messages and metadata) and put it into the turns[]
of the next request.
request 1
{
"assistant_id": 1,
"input": [{ "type": "text", "text": "What is Laravel?" }]
}
request 2 — with history
{
"assistant_id": 1,
"input": [{ "type": "text", "text": "How does routing work?" }],
"turns": [
{
"input": [/* from response 1 */],
"output": [/* from response 1 */],
"messages": [/* from response 1 — required */],
"metadata": {/* from response 1 — optional */}
}
]
}
Rules
| Turn field | Pass it? |
|---|---|
messages | Required — it’s the model’s actual context. |
output | Yes — used for file context and by some tools. |
input | Yes. |
metadata | Optional — only the client needs it, to display the cost. |
The order in turns[] is chronological, oldest turns first.
Common mistakes
| Situation | Consequence |
|---|---|
messages: [] or missing | The model doesn’t see the history — the context is empty. |
Only metadata passed, without messages | Same thing. |
turns[] in reverse order | The model sees the history backwards. |
| A very long history | You may exceed the model’s context limit. |
Native image models
An assistant message from a native image model contains the full base64 image data in
messages. Passing such a turn in turns[] adds several MB to the request body.
If you don’t need the history, you can leave that messages out.