Skip to main content

Overview

Create realtime sessions for audio and video streaming with OpenAI’s Realtime API.

Python Usage

Create Session

Default model is now gpt-realtime (OpenAI’s GA realtime id). The previous default gpt-4o-realtime-preview is deprecated by OpenAI but still works if you pass it explicitly — only the omitted-model default changed.

Session Configuration

Async Usage

Parameters

Available Voices

  • alloy - Neutral
  • echo - Male
  • fable - British
  • onyx - Deep male
  • nova - Female
  • shimmer - Soft female

Result Object

The RealtimeSession object contains:
  • id: Session ID
  • status: Session status
  • model: Model being used
  • url: WebSocket URL to connect to
  • metadata: Session configuration

WebSocket Connection

After creating a session, connect via WebSocket: