guides/websocket-mode.md +16 −3
2 2
3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.
4 4
55The Responses API supports a WebSocket mode for long-running, tool-call-heavy workflows. Beyond lowering latency, `stream_id` lets one persistent connection to `/v1/responses` run parallel conversations and fork an existing conversation onto a new stream. Continue each turn by sending only new input items plus `previous_response_id`.The Responses API supports a WebSocket mode for long-running, tool-call-heavy workflows. Beyond lowering latency, `stream_id` enables WebSocket multiplexing: one persistent connection to `/v1/responses` can run parallel conversations and fork an existing conversation onto a new stream. Continue each turn by sending only new input items plus `previous_response_id`.
6
7This pattern is WebSocket multiplexing: multiple logical response lanes over one persistent connection.
8 6
9WebSocket mode is compatible with both Zero Data Retention (ZDR) and `store=false`.7WebSocket mode is compatible with both Zero Data Retention (ZDR) and `store=false`.
10 8
326}324}
327```325```
328 326
327`invalid_stream_id`
328
329```json
330{
331 "type": "error",
332 "status": 400,
333 "error": {
334 "type": "invalid_request_error",
335 "code": "invalid_stream_id",
336 "message": "The 'stream_id' field must be a non-empty string with at most 256 characters and may only contain letters, numbers, underscores, hyphens, and periods.",
337 "param": "stream_id"
338 }
339}
340```
341
329`websocket_stream_limit_reached`342`websocket_stream_limit_reached`
330 343
331```json344```json