Audio formats
Set the format on input and output in
session:
input_audio_buffer.append. Send continuous frames, including silence, so the server can detect speech. Frames of about 100 ms work well.
For
audio/pcmu and audio/pcma, send 8 kHz G.711 audio encoded as base64. The server decodes it.Turn detection
audio.input.turn_detection controls when a user turn ends and the reply starts.
Server VAD (default)
Manual turns
Use manual mode for push-to-talk or when your app decides when to respond.commit when the user releases the button, then response.create to get the reply.
Barge-in
The user can talk over the reply.- The server confirms the interruption from the transcript. Backchannels such as “ok” or “haan” do not cut off the reply.
- When a real interruption is confirmed, the server emits
input_audio_buffer.speech_started. Stop local playback at that point. - Tell the server how much audio the user heard with
conversation.item.truncateso the next turn’s context matches what was played.
Transcription languages
The server transcribes user speech and replies in the language the user speaks, in its native script. Setaudio.input.transcription.language to one code or an array of codes. Arrays are a 60db extension.