Overview
Client events are messages sent from the frontend to the Unmute backend server. These events control session configuration and stream audio data.session.update
Configure the conversation session, including voice selection and conversation instructions. The backend requires this event before it begins processing. Send this immediately after connecting.Parameters
Must be
"session.update"Unique event identifier (auto-generated)
Session configuration object
Voice identifier for text-to-speech. Get available voices from
/v1/voices endpoint.Whether to allow recording of the conversation. Set to
false to disable recording.Example
Response
The server responds with asession.updated event confirming the configuration.
input_audio_buffer.append
Stream audio data from the user’s microphone to the server.Parameters
Must be
"input_audio_buffer.append"Unique event identifier (auto-generated)
Base64-encoded Opus audio dataAudio Specifications:
- Codec: Opus
- Sample Rate: 24 kHz
- Channels: Mono
- Encoding: Base64 string
Example
Implementation Notes
- The server decodes the base64 audio and processes it through an Opus stream reader
- The first packet must have the “beginning of stream” bit set (bit 2 in byte 5)
- Audio is processed in real-time for speech detection and transcription
- The server may send
input_audio_buffer.speech_startedwhen speech is detected
JavaScript Example
Error Handling
If the client sends invalid messages, the server responds with anerror event:
Invalid JSON
Invalid Message Structure
Next Steps
Server Events
Learn about events sent from server to client
Session Management
Configure voice and conversation settings