Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Connect

beta.responses.connect()
Function

Connect to a persistent Responses API WebSocket. Send response.create events and receive response stream events over the socket.

Connect

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
client.beta.responses.connect()
Returns Examples