Stream output as it is produced instead of waiting for the full response — cutting perceived latency for chat, and enabling real-time playback and transcription for voice. This guide covers chat streaming; for audio output see streaming speech below, and for live transcription see realtime STT further down.
Set stream: true in your request. The API responds with a series of server-sent events (SSE). Each event contains a chat.completion.chunk with a delta object — read choices[0].delta.content and concatenate to build the full message. The stream ends with data: [DONE].
Parse SSE manually (browser / edge runtimes without the SDK):
Text-to-speech streams too, so playback can start before synthesis finishes — essential for voice agents and any real-time audio. Two ways to consume it:
stream_format: "sse" to receive OpenAI speech events (speech.audio.delta / speech.audio.done).response_format (pcm, or mulaw for telephony) and read the body incrementally. Voice-agent frameworks like pipecat and LiveKit do this out of the box — no client changes.Full request/response details and examples are in the Text-to-Speech reference → Streaming.
Speech-to-text streams in the other direction: open a WebSocket, send audio up as it is captured, and receive transcript events back with sub-second latency — for live calls rather than pre-recorded files. Not every STT model supports this; check the streaming field on GET /v1/models before opening the socket rather than discovering it from a rejected handshake.
Connection, message shapes, and error handling are in the Speech-to-Text reference → Realtime transcription.