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
System Design
Software Engineer
OpenAI
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

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
WebRTC
stateful routing
voice activity detection
latency budget
session affinity
jitter buffers
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. 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 Problems
Sample 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_...

Submit Your Answer
Markdown supported