Skip to main content

OpenAIRealtime

OpenAI Realtime speech-to-speech (S2S) model.

Constructor

apiKey
string
config
OpenAIRealtimeConfig | null

cleanup

close

getRuntimeConfig

returns
Record<string, any>

SUPPORTED_VOICES

Voice ids supported by the OpenAI Realtime model.

TurnDetectionConfig

Server-side voice-activity turn-detection settings. Pass null to disable.

Fields

type
string
Detection mode. Default 'server_vad'.
threshold
number
Speech-probability threshold in [0, 1]. Default 0.5.
prefixPaddingMs
number
Audio padding (ms) prepended before detected speech. Default 300.
silenceDurationMs
number
Trailing silence (ms) that ends a turn. Default 200.
createResponse
boolean
Auto-create a model response when a turn ends. Default true.
interruptResponse
boolean
Allow user speech to interrupt the model’s response. Default true.

InputAudioTranscriptionConfig

Input-audio transcription settings. Pass null to disable transcription.

Fields

model
string
Transcription model id. Default 'gpt-4o-mini-transcribe'.

OpenAIRealtimeConfig

Configuration for OpenAIRealtime.

Fields

model
string
Realtime model id. Default 'gpt-4o-realtime-preview'.
voice
string
Voice id (see SUPPORTED_VOICES). Default 'alloy'.
modalities
string[]
Response modalities. Default ['text', 'audio'].
temperature
number
Sampling temperature. Default 0.8.
maxResponseOutputTokens
number | string | null
Max output tokens per response. Default the string 'inf' (unlimited); null omits the param.
turnDetection
TurnDetectionConfig | null
Turn-detection settings, or null to disable. Defaults applied when omitted.
inputAudioTranscription
InputAudioTranscriptionConfig | null
Input-audio transcription settings, or null to disable. Default model applied when omitted.
toolChoice
string
Tool-selection strategy. Default 'auto'.