Skip to main content
GET /v1/responses

Handshake

Upgrade with a WebSocket client at placeholder URL wss://gateway.example.com/v1/responses, sending Authorization: Bearer YOUR_API_KEY. There is no HTTP JSON body. The library supplies Upgrade, Connection, Sec-WebSocket-Key, and version headers. Success is HTTP 101; failures may be 400 / 401 / 403 / 429 / 5xx or a proxy response. The first create event supplies the model, and channel selection follows the handshake. Each create runs request authentication and rate-limit checks again. A compatible channel with ResponsesWebSocketEnabled is required. This GET is not resource retrieval; use GET with an ID for plugin tasks.

Client messages

The parser also accepts a nested response object for create. The example consistently uses the top-level form. stream, background, and stream_options are not forwarded as transport settings; the connection already uses events. See create response for common fields, without assuming all HTTP extensions are equivalent. These are separate illustrative messages; the cancellation ID must come from an active response:

Server messages

Deltas and final objects use Responses structures, not Chat choices or Realtime sessions. The example buffers results and rejects tools and refusals. A complete function loop still belongs in the application. See Responses streaming events for protocol context.

Limits and recovery

Overlapping create events may receive an error with status 409. A successful handshake does not guarantee future authorization, rate-limit admission, or continued channel availability. Active requests have bounded pending controls; cancellation can fail separately. Configuration or upstream connection changes can require reconnecting. Socket closure, missing terminal events, errors, and local deadlines do not indicate success. Official multiplexing, cached reconnect state, or a 60-minute lifetime are not gateway guarantees; deployments may impose shorter timeouts. Source: router/relay-router.go, controller/responses_websocket.go, relay/responses_websocket.go, checked at 30a6d88a4. Runnable example · Shared connection module 阅读中文