Skip to main content
The Realtime API provides a bidirectional WebSocket session for low-latency audio streaming. The SDK wraps the raw WebSocket with typed send/receive helpers.
Python requires pip install 'meshapi[realtime]' (adds websockets>=12.0).
Node.js on Node 18–21 requires npm install ws. Node 22+ has WebSocket built in.
Protocol. The realtime API uses OpenAI’s GA event shape: configure the session with session.type: "realtime", output_modalities, and an audio object (see below). Input audio is sent as base64 (send_audio handles this for you), and output audio arrives as response.output_audio.delta events — the SDK decodes these into msg.audio so you can play them directly. Audio is 24 kHz mono PCM16.

Connect and configure

Async variant:

Receive frames

The server sends a session.created event immediately after the WebSocket handshake completes.

Send audio

Pass raw 16-bit PCM audio (24kHz mono) to send_audio / sendAudio / SendAudio.

Error handling

Errors in the WebSocket session are surfaced as RealtimeError (Python/Node.js) or *meshapi.MeshAPIError (Go).

Supported models

Consult GET /v1/models for the current set of realtime-capable models — the catalog is live and this table is a snapshot.