POST /api/v1/converse streams one model turn over Server-Sent Events. You send the whole conversation every time, you supply the tool definitions, and you run any tool the model asks for. The platform stores no conversation and runs no tool. Use it when your application already owns conversation state and you want a metered model gateway. Use a Conversation instance when you want the platform to keep transcripts, run platform tools, enforce guardrails, and gate releases with evals.
Credential: an organization API key, or a scoped key with conversations:use. The route uses the default org rate limit bucket and is exempt from the 30-second request timeout.
How it works
- You post
messages(the whole history), optionalsystem, optionaltools, and optionalmodelandmax_tokens. - The platform streams
message_start, thentext_deltaframes and onetool_useframe per tool call the model makes, thenmessage_end. - If
message_end.stop_reasonistool_use, you run the tools, append the assistant’stool_useblocks and yourtool_resultblocks tomessages, and post the whole conversation again.
Request
Content blocks:
File and image blocks are not accepted on this route.
The example below uses Harbor Group, a fictional company whose staff look up the review status of its suppliers. The tool runs in your application, not on the platform. Tool names use letters, digits,
_, ., and -, must not contain __, and must be at most 64 characters where each . counts as two.
The stream
Headers and framing match the instance turn route:Content-Type: text/event-stream, one event: line and one data: line of JSON per frame, then a blank line.
stop_reason is end_turn for a finished answer, tool_use when the model wants tools run, and max_tokens when the output was cut off at max_tokens. Any other provider value passes through unchanged. usage has the same six fields as on instance turns; cached_input_tokens is filled by OpenAI models and is a subset of input_tokens, while cache_creation_input_tokens and cache_read_input_tokens are filled by Anthropic models.
Continue after a tool call
Append the assistant’s tool call and your result, then post everything again:Errors
Before the first frame, errors use the JSON envelope. After it, the status is already200 and the failure is a terminal error frame with code and message. This route does not include the provider failure reason that instance turns carry.
A model call that fails transiently is attempted up to three times, with waits of at most 5 seconds, while nothing has been streamed. Once a frame is sent, a failure is final.
Metering
A completed call records one usage row for your org with the model and token counts, when the provider reports token usage. Stateless calls are not tied to any instance or conversation.Conversations overview
When a managed instance fits better.
Converse (API reference)
The generated endpoint contract.