Connect
beta.responses.connect()
Function
Connect to a persistent Responses API WebSocket. Send response.create events to create responses and response.steer events to queue user input containing text, images, or files for a continuation. Receive response stream events and steering acceptance, pending, or failure 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()