Alternative to Socket.IO streaming - uses standard HTTP Server-Sent Events (SSE). Ideal for server-side integrations, SDKs, and environments where WebSockets aren’t available.
Returns text/event-stream with SSE-formatted JSON chunks:
data: {"type":"connected","message":"Stream connected"}
data: {"type":"stream","prompt":"Hello, "}
data: {"type":"stream","prompt":"I can help with that..."}
data: {"type":"complete","success":true,"usage":1234}
data: {"type":"done"}
| Type | Description |
|---|---|
connected | Stream established |
stream | Text chunk from AI |
tool | Tool invocation (RAG, search, etc.) |
complete | Final response with metrics |
error | Processing error |
done | Stream ended |
Close the HTTP connection to cancel the request.
JWT token passed in x-access-token header
SSE stream of AI response chunks
Server-Sent Event payload structure for HTTP streaming
Event type indicator:
connected: Stream established successfullystream: AI-generated text chunktool: Tool/function being invoked (RAG, web search, etc.)complete: Final response with usage metricserror: Error occurred during processingdone: Stream terminatedconnected, stream, tool, complete, error, done Text content chunk (stream events only)
Status message (connected events only)
Tool/function name being invoked (tool events only)
Tool execution status (tool events only)
Request success indicator (complete events only)
Total tokens consumed (complete events only)
Full AI response (complete events only)
AI model used (complete events only)
Error details (error events only)