Endpoint
Authentication
Pass your Inworld API key as a Bearer token. The proxy forwards it to the realtime service.Flow
- Fetch config from your server (API key + ICE servers)
- Create
RTCPeerConnectionwith ICE servers - Create data channel
oai-events+ add microphone track - Create SDP offer → POST it with optional initial session config to
/v1/realtime/calls→ set SDP answer - Data channel opens → send any later
session.updatepatches → start conversation
Session config
You can configure the session during signaling or through the data channel:- During signaling: include the session object in a JSON or multipart
/v1/realtime/callsrequest. The proxy sends it upstream as an initialsession.updatebefore returning the SDP answer. It requires a successful send but does not wait forsession.updated. - After connection: send
session.updatethrough the data channel. Partial updates patch the initial configuration.
session.update through the data channel. See Configuring Models for the full breakdown of STT, LLM, and TTS configuration.
providerData carries Inworld-specific extensions to the OpenAI-compatible session shape — STT tuning, TTS segmentation/steering, automatic memory, and more. Most providerData fields are hot-swappable via partial session.update, but a few are read only at session open and ignored afterwards (notably providerData.tts.conversational and providerData.tts.user_turn_mode). See Inworld Realtime API Extensions for the field-by-field reference.
Audio
Unlike WebSocket (manual base64 PCM), WebRTC handles audio natively:- Input: browser captures mic and sends OPUS over RTP automatically
- Output: proxy sends AI audio back as an RTP track — attach to
<audio>to play
response.output_audio.delta events are not sent through the data channel — audio is delivered via the RTP track instead.Text & Responses
Same as WebSocket, but sent through the data channel:Events
Same event types as WebSocket, received on the data channel.Option 1: Direct WebRTC
Server — serves the page and a/api/config endpoint that fetches ICE servers and keeps the API key hidden:
Option 2: OpenAI Agents SDK
The OpenAI Agents SDK manages the full WebRTC lifecycle — peer connection, SDP exchange, mic, and audio playback:/api/config endpoint is identical to Option 1.
WebSocket vs WebRTC
API reference for full event schemas.