Connect to the WebSocket URL returned when creating a session.
Send audio data (PCM16, 16kHz):
{
"type": "audio",
"seq": 1,
"data": "base64-encoded-pcm16",
"sampleRate": 16000
}
Notify that user started speaking:
{ "type": "speech_start" }
Notify that user stopped speaking:
{ "type": "speech_end" }
Stop AI response (barge-in):
{ "type": "interrupt" }
{
"type": "transcript",
"text": "Hello",
"isFinal": true
}
{
"type": "response_text",
"text": "Hi there!",
"isFinal": false
}
{
"type": "audio",
"seq": 1,
"data": "base64-encoded-pcm16"
}