Multi-turn conversations
A conversation is multi-turn when the model needs what was already said. Send prior turns in input on every request, have Gateway store a turn and continue from its ID, or, for Claude on /v1/messages, use Anthropic message threads.
Send the conversation in input
This works on every model and route, needs no setup, and Gateway keeps nothing, so it’s the right default.
On most routes the repeated prefix is cached and billed at a lower rate.
Let Gateway hold the conversation
Send store: true and Gateway saves the turn under the response id. Next time, pass that ID as previous_response_id with only the new input; Gateway replays the stored conversation ahead of it.
Send store: true on every turn you want to resume from; a resumed turn without it runs but isn’t saved.
Omitting store stores nothing, unlike the OpenAI API, which defaults to true. A client that relies on the OpenAI default gets a 404 on previous_response_id until it sends store: true.
The store is best-effort (records can expire or fail to be stored), so keep your own transcript as the fallback. It doesn’t lower token cost: the vendor still receives the full conversation. Only text and tool calls replay. Reasoning blocks, vendor-run tool results such as web search, and generated images are dropped, since the next turn may route to another vendor. /v1/openai/responses and /v1/ai-sdk accept store and previous_response_id too.
Read or delete a stored response
GET returns an object with object: "response.stored" and the stored input, output, previous_response_id, and vendor. DELETE returns {"id": "...", "object": "response.deleted", "deleted": true} and ends the chain.
Reference
Anthropic message threads
On POST /v1/messages, Gateway supports Anthropic’s message threads (beta). Send the full conversation once with thread: {"type": "create"}, then send each later turn with only the new message and the previous response’s id. Anthropic holds the conversation between turns, so a long agent loop stops resending a growing transcript. Gateway adds Anthropic’s beta header whenever the body has thread, so you don’t need to.
A continue sends only the new turn. It can’t carry system or tools, even as null, because the thread keeps the ones from the request that created it. Like the response store, a thread is best-effort, so keep your own transcript as the fallback.
The 404 uses Anthropic’s error shape, so branch on error.details.error_code: