What You Need to Know
Server-Sent Events (SSE) was the original transport for OpenAI streaming. It works over standard HTTP but adds overhead: each response requires a new connection, TLS handshake, and HTTP negotiation. For interactive conversations where users expect near-instant first-token delivery, this overhead is noticeable.
WebSocket transport maintains a persistent connection between OpenClaw and OpenAI's API. Once established, subsequent requests skip the connection setup entirely. First-token latency drops measurably, and the bidirectional nature of WebSocket allows for more efficient flow control during long streaming responses.
The default transport: "auto" setting tries WebSocket first and falls back to SSE if the WebSocket connection fails (e.g., behind corporate proxies that block WebSocket upgrades). You can force a specific transport with transport: "ws" or transport: "sse" in your model params if you need deterministic behavior.
Optional warm-up via params.openaiWsWarmup pre-establishes the WebSocket connection when the gateway starts, rather than waiting for the first user message. This eliminates the connection setup latency even for the first request after a gateway restart. Enable it if first-response speed matters for your workflow โ the cost is a single idle WebSocket connection.
The Responses store and compaction logic has also been unified across both transports, fixing an edge case where SSE and WebSocket sessions could produce different compaction behavior. Regardless of transport, session state is now identical.