Long Responses
An HTTP request to the API can run for up to 15 minutes. For a response that takes longer, connect to /v1/responses over a WebSocket and send the same request. This works with every text model, and it uses the WebSocket mode of the OpenAI Responses API, so the OpenAI SDKs connect to it directly.
Nothing is stored. The response reaches you as it is written, like a stream, so stay connected until it ends.
Endpoint
WEBSOCKET /v1/responses
Authenticate with your API key in the Authorization header of the WebSocket handshake:
If the connection cannot start, the handshake is refused with the same HTTP status and JSON error body as the REST API.
Send a request
Each request is a response.create message: the POST /v1/responses body, with type added and without stream. Events come back as one JSON message each, the same events a streaming POST /v1/responses sends.
With the OpenAI Python SDK (pip install "openai[realtime]"):
Without an SDK:
A request that cannot run is answered with an error event, and the connection stays open for your next request:
Limits and behavior
Requests are the same as POST /v1/responses, with these differences:
- Send the full conversation in
inputwith every request. Responses are not stored, soprevious_response_idreturnsprevious_response_not_found, andgenerate: falsereturns400. background: trueis not available, here or over HTTP.- If the connection drops, the rest of the response does not reach you, and the request bills under the cancellation policy. Send the request again to get it.
Billing
Each response is billed as its own request, at the same rates as POST /v1/responses, and appears on its own line in your usage. Opening a connection costs nothing.
At the 15 minute HTTP limit
A request over HTTP that reaches 15 minutes ends with a timeout error that names this page’s endpoint, on every text endpoint:
- A stream sends what was written so far, then the error event of its protocol.
- A request without
streamreturns the error in its JSON body.
The request bills under the cancellation policy. Send it over the WebSocket to run it to the end.
