Realtime API
Server events
The events the Realtime socket sends, in OpenAI’s Realtime transcription format. Ignore event types you do not handle.
Events
| Event | Meaning |
|---|---|
session.created | The session is open. |
session.updated | The configuration in effect. Fields without effect come back as null. |
input_audio_buffer.speech_started | A new segment has begun: item_id, audio_start_ms. |
conversation.item.input_audio_transcription.delta | New text for the segment named by item_id, in delta. |
input_audio_buffer.speech_stopped, input_audio_buffer.committed | The segment has ended: item_id, with audio_end_ms or previous_item_id. |
conversation.item.input_audio_transcription.completed | The segment’s full transcript, with audio_start_ms and audio_end_ms. |
error | A problem with an event, in error.code and error.message. The session continues unless the socket closes. |
session.end | The session has ended, just before the socket closes: reason and stats. An addition of .wave’s. |
Speech events
Speech events follow the recognized text, so they arrive slightly after the sound. For the acoustic onset, run your own voice activity detector.
Why a session ended
session.end.reason is client_close, deleted, idle_timeout, max_duration, input_audio_overflow, protocol_error, server_shutdown or internal_error. session.end.stats counts the session’s audio, such as frames, late_frames, missing_frames and duplicate_frames. The socket then closes with a close code.