
Tech • AI • Robotics • Game
⏱ ≈ 3 min read · 5-min video — 2 min saved
GPT Live voice apps rely on a persistent, two-way connection so audio can stream to and from the model in real time, with WebRTC recommended as the default transport.
Voice applications cannot wait for a user to finish speaking before sending input, as text apps often do. Audio must be transmitted continuously while the person speaks, and the model’s spoken response must also be played as it is generated. Because listening and speaking can happen at the same time, the connection must remain open for the full conversation and support simultaneous two-way audio.
A WebSocket connection allows an application and a server to exchange messages in both directions at any time, and it can carry audio data. But it is not designed specifically for live audio, so developers must handle more of the streaming logic themselves. That includes smoothing playback when chunks of the model’s speech arrive at uneven intervals.
WebRTC is built for live audio and video and handles much of the complexity automatically. It can compress audio efficiently and keep playback smooth even when packets arrive irregularly, reducing the amount of custom code required. For browser, mobile, and server voice applications using GPT Live, it is the recommended connection method.
For agents that users reach by telephone, connections can also be established through a phone provider using SIP, a standard for internet phone calls. That route is aimed at telephony use cases rather than direct browser-based audio sessions.
In a typical browser setup, the user grants microphone permission when starting a conversation. Before any audio can flow, the browser and OpenAI must agree on the technical details of the session, including the audio format and network information needed to reach each other.
The browser generates an SDP offer, short for Session Description Protocol, which describes how it can exchange audio. This text description does not need to be written manually. The offer is sent through the application’s server, where the OpenAI API key is kept securely.
Using the API key, the server creates a session with OpenAI and forwards the browser’s offer along with configuration details such as the model name and assistant instructions. OpenAI returns an SDP answer describing its side of the connection. The server sends that answer back to the browser, allowing the browser to complete the handshake and start the session.
Once connected, the session carries both sound and messages. The microphone audio goes to the model while the model’s voice returns to the browser, and WebRTC treats these as separate audio tracks that can stay active at the same time. A data channel runs alongside them, carrying items such as transcript segments, session updates, and events tied to delegated tasks.
Applications are not limited to receiving events. They can also send commands back through the same data channel, including requests such as ending the conversation. That gives developers a direct way to manage the live interaction without interrupting the audio flow.
As a session grows longer, GPT Live can summarize the conversation automatically. Because summarization may omit some details, applications are advised to store important information themselves and provide it again later when necessary. That design helps preserve critical context across extended exchanges.
Beyond the browser’s direct WebRTC link, a server can later join the same GPT-4 Live session through a second connection called a sideband. This uses a WebSocket and allows the server to receive transcripts and delegation requests, while also sending information back to the live session. The browser can continue handling microphone capture and voice playback at the same time.
The core technical requirement for a GPT Live voice app is a persistent, bidirectional connection that supports simultaneous listening, speaking, and event handling. In most modern applications, WebRTC provides the most practical foundation, while servers add security, session setup, and optional sideband control.
Ask a question