Initialise a stream
/ai/streams/initCreates a stream bound to a chat. Pass the returned streamId on
POST /ai/chats/{ref}/messages and poll GET /ai/streams/{streamId}
from a separate connection.
Note: the message POST is synchronous and won't release until the AI finishes. Polling must happen on a different connection (a separate thread / async task in your client).
Authorization
apiKey Issued to you when your integration is provisioned. Determines which catalogue resources are visible and which AI tools are available.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/ai/streams/init" \ -H "Content-Type: application/json" \ -d '{ "chatRef": 0 }'{ "data": { "streamId": "stream_69f352eb1975d", "ref": 0, "chatRef": 0 }}Poll a stream GET
Returns the current accumulated content. Safe to poll. Once `isComplete` is true, stop polling and either inspect `content` here or `GET /ai/chats/{ref}` for the saved assistant message.
Abort a stream POST
The inflight provider call may run a moment longer until the abort marker is observed. The assistant message that gets saved at the end of the message-POST may still contain partial content.