openai_dart_realtime library

Realtime API for OpenAI.

Provides real-time conversations via WebSocket (audio streaming) and WebRTC (HTTP-based SDP signaling with call management).

Import with prefix to avoid naming conflicts with Responses API:

import 'package:openai_dart/openai_dart.dart';
import 'package:openai_dart/openai_dart_realtime.dart' as realtime;

// Responses API event
final event = ResponseCreatedEvent(...);

// Realtime API event
final rtEvent = realtime.ResponseCreatedEvent(...);

Classes

ClientSecret
An ephemeral client secret for realtime API authentication.
ConversationCreatedEvent
Conversation created event.
ConversationItemCreatedEvent
Conversation item created event.
ConversationItemDeletedEvent
Conversation item deleted event.
ConversationItemTruncatedEvent
Conversation item truncated event.
ErrorEvent
An error event.
ExpiresAfter
Configuration for when a client secret expires.
InputAudioBufferClearedEvent
Input audio buffer cleared event.
InputAudioBufferCommittedEvent
Input audio buffer committed event.
InputAudioBufferSpeechStartedEvent
Input audio buffer speech started event.
InputAudioBufferSpeechStoppedEvent
Input audio buffer speech stopped event.
InputAudioTranscription
Input audio transcription configuration.
InputAudioTranscriptionCompletedEvent
Input audio transcription completed event.
InputAudioTranscriptionDeltaEvent
Input audio transcription delta event.
InputAudioTranscriptionFailedEvent
Input audio transcription failed event.
InputAudioTranscriptionSegmentEvent
Input audio transcription segment event.
NoiseReductionConfig
Configuration for input audio noise reduction.
RateLimit
A rate limit.
RateLimitsUpdatedEvent
Rate limits updated event.
RealtimeCallCreateRequest
Request for creating a WebRTC call.
RealtimeCallReferRequest
Request for referring (transferring) a call.
RealtimeCallRejectRequest
Request for rejecting an incoming call.
RealtimeClientSecretCreateRequest
Request for creating a client secret with session configuration.
RealtimeClientSecretCreateResponse
Response from creating a client secret.
RealtimeError
A realtime error.
RealtimeEvent
Base class for all realtime events.
RealtimeSession
Configuration for a realtime session.
RealtimeSessionCreateRequest
Request for creating a realtime session via HTTP.
RealtimeSessionCreateResponse
Response from creating a realtime session via HTTP.
RealtimeTool
A tool for realtime sessions.
RealtimeToolChoice
Tool choice for realtime sessions.
RealtimeToolChoiceAuto
Auto tool choice - let the model decide.
RealtimeToolChoiceFunction
Function tool choice - require a specific function.
RealtimeToolChoiceNone
None tool choice - disable tool use.
RealtimeToolChoiceRequired
Required tool choice - force tool use.
RealtimeTranscriptionSessionCreateRequest
Request for creating a realtime transcription session via HTTP.
RealtimeTranscriptionSessionCreateResponse
Response from creating a realtime transcription session via HTTP.
ResponseAudioDeltaEvent
Response audio delta event.
ResponseAudioDoneEvent
Response audio done event.
ResponseAudioTranscriptDeltaEvent
Response audio transcript delta event.
ResponseAudioTranscriptDoneEvent
Response audio transcript done event.
ResponseContentPartAddedEvent
Response content part added event.
ResponseContentPartDoneEvent
Response content part done event.
ResponseCreatedEvent
Response created event.
ResponseDoneEvent
Response done event.
ResponseFunctionCallArgumentsDeltaEvent
Response function call arguments delta event.
ResponseFunctionCallArgumentsDoneEvent
Response function call arguments done event.
ResponseOutputItemAddedEvent
Response output item added event.
ResponseOutputItemDoneEvent
Response output item done event.
ResponseTextDeltaEvent
Response text delta event.
ResponseTextDoneEvent
Response text done event.
SessionCreatedEvent
Session created event.
SessionUpdateConfig
Configuration for updating a session.
SessionUpdatedEvent
Session updated event.
TurnDetection
Turn detection configuration.

Enums

RealtimeAudioFormat
Audio format for realtime sessions.
RealtimeVoice
Voice options for realtime audio output.
TurnDetectionType
Turn detection type for realtime sessions.