Skip to main content
WSS
Connect to the WebSocket and send TTS requests to convert text into streaming audio.

Quick Start

  1. Enter your API key in the authentication field
  2. Click Connect to establish the WebSocket connection
  3. Modify the request payload with your text
  4. Click Send to receive streaming audio

Request Message

After connecting, send a JSON message with the following structure:
type
string
required
Must be "tts"
payload
object
required
TTS Request

Response Sequence

The server responds with:
1. Acknowledgment
2. Binary Audio Chunks
3. Stream End

Dialects and Voice Examples

Pick a speaker that matches your chosen dialect. Voice examples per dialect:

Available Speakers

Refer to Hamsa Platforms to get the list of the available pre-built speakers where you can take the name of the speaker, or use a UUID for your custom cloned voice.

Using Custom Cloned Voices

When using a custom cloned voice (UUID) as the speaker, you must preload the voice before establishing the WebSocket connection. This ensures optimal latency during streaming.
Preload Required for Custom VoicesCall the Preload Voice endpoint once when your application starts to avoid latency when using custom cloned voices.
api_key
type:httpApiKey

API key passed as query parameter or X-Api-Key header

TTS Request
type:object

Request to convert text to speech

TTS Acknowledgment
type:object

Server acknowledges the TTS request

TTS Audio Chunk
type:string

Binary audio data chunk

TTS Stream End
type:object

Signals the end of the audio stream

Error Response
type:object

Error message from the server