Skip to main content

text/event-stream

text

The MIME type for Server-Sent Events (SSE) streams. The server responds with Content-Type: text/event-stream to establish a persistent SSE connection. The browser's EventSource API specifically looks for this type. Always set Cache-Control: no-cache alongside it. Used by OpenAI, Anthropic, and Gemini for LLM token streaming.

Details

text/event-stream is defined by the WHATWG HTML Living Standard §9.2 and IANA-registered.

Required headers for SSE: Content-Type: text/event-stream Cache-Control: no-cache X-Accel-Buffering: no (for nginx – prevents buffering the stream)

Browser behavior: the EventSource API only opens the connection if the server responds with exactly text/event-stream. Other types cause an error event.

LLM streaming: every major LLM API (OpenAI, Anthropic Claude, Google Gemini, Mistral) uses text/event-stream for token streaming. The pattern: data: {"delta":"token"} repeated, then data: [DONE] as sentinel.

Common use

Server-Sent Events (SSE) connections, LLM token streaming, real-time dashboards

See Also