Skip to main content
POST
Chat (Streaming)

Overview

Takes the same body as Chat, but streams the reply back as server-sent events while the assistant writes it. Member keys can use it.

Authorization

string
required
Your Composer API key

Body

string
required
The assistant to talk to.
string
required
The conversation, from Create Conversation.
string
required
Your message.
string
Your IANA time zone, for example America/New_York.
string
The surface the message comes from, such as sms. Omit for a web chat.
array
Files attached to this message: [{ filename, excerpt }]. An attachment can also carry image (the object_uri of an uploaded image) and mime.
Example Request

Events

The response is text/event-stream. Each event has a name and data: The stream also sends keep-alive comments. Ignore them.

The done event

string
The full reply.
string
The id of this turn.
string
The conversation the turn landed in. Use this for follow-ups.
array
Pictures or charts drawn in this reply.
array
Places found on the map in this reply.
boolean
True when the reply was stopped before it finished.
number
Time to the first token of the reply, in milliseconds.
Example Stream

Example cURL

cURL

Error Codes