How OpenAI delivers low-latency voice AI at scale
OpenAI rearchitected its WebRTC stack for ChatGPT voice and the Realtime API by splitting a stateless UDP relay from a stateful Go/Pion transceiver that owns ICE, DTLS and SRTP state. The design avoids one-public-port-per-session media termination, which fits poorly with Kubernetes and cloud load balancers. Server-generated ICE ufrags encode routing hints, so the relay can steer the first STUN packet to the owning transceiver without an external lookup. Relay flows are kept in memory with Redis as a backup, and Cloudflare geo-steered signaling plus a globally distributed relay fleet shorten the first hop and cut setup latency.
Related posts
- How we built a realtime system for responsive voice AI in six months
OpenAI mediumAdept
GPT-Live replaces turn-detector-based voice AI with a full-duplex voice model that listens and speaks simultaneously, delegating deeper reasoning and tool use to frontier models like GPT-5.5 over an asynchronous RPC path that never blocks media. The system separates a Go-based media fast path (replacing Python asyncio, with new p95 matching old p50) from application logic. It uses warm model-instance handoffs to perform context compaction without KV-cache rebuild pauses, prefills frontier-model sessions at call start, and derives discrete turns from overlapping speech via speculative and authoritative transcript views. Startup is cut to a single UDP packet through WARP, a set of backward-compatible WebRTC changes that reduces handshakes from six round trips to one, plus Instant Connect for pre-negotiated SDP. Shadow testing on production traffic showed that capacity depends on concurrent sessions and CPU-side stream handling, not just GPU throughput.
- One-second voice-to-voice latency with Modal, Pipecat, and open models
Modal mediumAdept
A conversational voice bot on Modal reaches roughly one-second voice-to-voice latency. It uses Pipecat to orchestrate an STT → RAG → LLM → TTS pipeline with Parakeet-tdt-v3, Qwen3-4B-Instruct on vLLM, Kokoro TTS, and ChromaDB with all-MiniLM-L6-v2 retrieval. The main latency levers are running the stateful Pipecat bot on CPU while GPU services autoscale independently, using Pipecat's local VAD and SmartTurn to segment audio instead of streaming STT, and tuning vLLM for time-to-first-token. On the network side, the bot talks to services over WebSockets through Modal Tunnels that bypass the input plane, with a spawned FunctionCall session restoring autoscaling, and services are pinned to clustered regions near the user. Latency was measured by recording real conversations and diarizing them with Pyannote across region and tunnel configurations.
- FastRTC: The Real-Time Communication Library for Python
Hugging Face mediumAdeptFastRTC is a Python library for building real-time audio and video AI applications over WebRTC or WebSockets without needing WebRTC expertise. A `Stream` wrapped around a `ReplyOnPause` handler provides built-in voice activity detection and turn taking, auto-generates a Gradio test UI, and can be mounted onto any FastAPI app for production. Bundled speech-to-text (Moonshine) and text-to-speech (Kokoro) models, optimized for CPU inference, let a few lines of code chain STT, an LLM and TTS into a voice chat. `fastphone()` exposes the stream through a free phone number with a Hugging Face token.
- Rapidly scaling online storage to serve over 1 billion ChatGPT users
OpenAI mediumAdept
Habitat, OpenAI's online storage platform, grew from a client-side Python library over Azure Cosmos DB into a centralized Python service handling 70M+ requests per second and 500+ PB across about 40 regions. It moved to a service because coordinating client-library rollouts across dozens of services had become slow and error-prone. Running Python at this scale meant fighting tail latency from asyncio event-loop scheduling delay, which the team measured directly and controlled by keeping per-process concurrency low and scaling out worker processes. Specific fixes included shrinking and jittering Statsig feature-flag config refreshes, and switching aiohttp's LIFO connection reuse to FIFO to break a metastable failure that concentrated load on already-slow processes.
- Real-time Messaging
Slack Engineering mediumAdeptSlack's real-time messaging runs on four Java services: stateful in-memory Channel Servers sharded by consistent hashing, regionally deployed Gateway Servers holding websocket subscriptions, stateless Admin Servers bridging the Webapp backend, and Presence Servers tracking online users. Consistent hash ring managers (CHARMs) registered in Consul replace failed Channel Servers in under 20 seconds. Messages flow from Webapp to Admin Server to the owning Channel Server, which fans out to every subscribed Gateway Server worldwide. Transient events like typing indicators skip persistence and enter directly through the Gateway. The system delivers messages globally within 500ms and handles tens of millions of channels per host.