Text To Speech WebSocket
WebSocket channel for real-time TTS synthesis.
Note: This API Reference page is provided for informational purposes only. The Try It playground may not provide the best experience for streaming audio. For optimal streaming performance, please use the SDK or implement your own WebSocket client.
HandshakeTry it
WSS
wss://api.sarvam.ai/text-to-speech/ws
Headers
Api-Subscription-Key
API subscription key for authentication
Query parameters
model
Text to speech model to use
Allowed values:
send_completion_event
Enable completion event notifications when TTS generation finishes. When set to true, an event message will be sent when the final audio chunk has been generated.
Allowed values:
Send
Configure Connection
Send initial configuration for text-to-speech streaming
OR
Send Text
Send text chunk for speech synthesis
OR
Flush Signal
Send signal to end text streaming.
OR
Ping Signal
Send ping signal to keep the TTS WebSocket connection alive.
Receive
Audio Output
Receive audio chunks from the TTS WebSocket.
OR
Event Notification
Receive completion event notifications from the TTS WebSocket (if send_completion_event is enabled)
OR
Error Response
Receive error messages from the TTS WebSocket