Recommended Formats
STT WebSocket Setup
TTS WebSocket Setup
audio messages contain base64-encoded mu-law chunks that can be
forwarded to a telephony media stream.
Chunk Size Guidance
Many telephony media streams send 20 ms frames. Gradium accepts small chunks, but batching to roughly 80 ms can reduce message overhead while keeping latency low:Bridge Checklist
- Preserve the provider’s stream/session ID in your own logs.
- Use one Gradium STT session per caller audio stream.
- Set
input_formatto the actual bytes you forward. - For TTS, request an output format your provider can play directly.
- Use STT
stepmessages or your provider’s VAD to decide when to send the user’s turn to an agent. - Close the WebSocket and start a new session if the call leg changes format.
Related
Speech-to-Text WebSocket
Real-time transcription with VAD and flush.
Text-to-Speech WebSocket
Stream generated audio back to your telephony bridge.