Realtime transcription
Stream 16 kHz PCM16 mono audio as base64 JSON events over an authenticated WebSocket.
Event flow
- Send
session.configureimmediately after connecting, then wait forsession.configured. - Send
input_audio_buffer.appendevents while receiving optionaltranscript.partialresults. - Send
input_audio_buffer.commit. Receiveinput_audio_buffer.committed, thentranscript.completedfor that utterance.
VAD and automatic duration boundaries can also commit an utterance. An empty manual commit returns input_audio_buffer.commit_empty. The connection stays open for subsequent utterances.
The audio example contains one 20 ms PCM16 chunk. Append all chunks before committing an utterance. Transcript examples illustrate the event format.
Handshake
Authentication
Send
Send once within 10 seconds of connecting. Wait for session.configured before sending audio. Open a new connection to change settings.
Commit pending audio. The server returns input_audio_buffer.committed, followed by transcript.completed. With no pending audio, it returns input_audio_buffer.commit_empty instead.
Receive
Configuration accepted; audio can now be sent. Returns applied settings and session.limits.
Replace the previous partial for this item_id; earlier words can change. A completed result can arrive without any partial.
Word-level alignment for an opted-in completed transcript. Match it by item_id; alignment is asynchronous, so other utterance events can arrive first.
Terminal alignment failure for an opted-in completed transcript. The matching transcript.completed remains valid.
Acknowledges a manual, VAD, or duration boundary. Use item_id to match the subsequent transcript.completed result.
Reports an error before the connection closes. Use error.code to choose the next action. For INSUFFICIENT_CREDITS, stop sending audio and add credits before reconnecting. See Errors and troubleshooting.