Design a Gateway for Low-Latency Speech-to-Speech Realtime API Sessions
Last updated: November 29, 2026
Quick Overview
Design the session layer for a speech-to-speech API where developers connect over WebRTC or WebSocket, stream microphone audio, and receive model audio back with barge-in support and sub-second response latency.
OpenAI
November 29, 20260
0
0 solved
Design the session layer for a speech-to-speech API where developers connect over WebRTC or WebSocket, stream microphone audio, and receive model audio back with barge-in support and sub-second response latency.
OpenAI's Realtime API and ChatGPT voice mode depend on long-lived, stateful audio sessions pinned to GPU capacity. The interviewer wants to see you reason about latency budgets in milliseconds, stateful routing, and what happens to a live conversation when infrastructure fails.
What the Interviewer Expects
- Lay out an end-to-end latency budget from mic to speaker
- Choose transports (WebRTC for browsers and phones, WebSocket for servers) and justify them
- Pin a session to an inference replica that holds its KV cache and conversation state
- Support interruption: stop playback and generation when the user starts speaking
- Plan capacity in concurrent sessions per GPU, not requests per second
- Address session migration and graceful drain during deploys
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you drain a GPU node with 300 live voice sessions for a kernel upgrade?
- Where should voice activity detection run, client or server, and why?
- How would you meter billing for audio input versus output tokens?
- How do you keep jitter low for users far from any GPU region?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: open a session with a model, voice and instructions; stream 20 ms audio frames up; get audio and text deltas down; client or server VAD; user can interrupt; tool calls mid-conversation...
High-Level Design
- Edge media servers (SFU-style) in many regions terminate WebRTC, handle jitter buffers, Opus decode, and forward PCM frames over a persistent internal stream.
- Session router maps `session_...