Send text incrementally on one connection for a single speech task.
multilingual_v2 and flash_v2_5.Connect → initialize → send text → send empty text → wait for final → disconnectwss://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.us.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.eu.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.jp.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket{voice_id} in the path and include the following WebSocket handshake header:api-key: <YOUR_API_KEY>flash_v2_5 or multilingual_v2. This endpoint does not support myvocal_v3.dedicated_concurrency.1..180.en or zh.0..4294967295. A seed improves consistency with identical settings. Byte-identical audio is not guaranteed.wss://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket?model_id=flash_v2_5&priority=dedicated_concurrency&format=pcm_16000&idleTimeout=120&language_code=zhtext is equivalent to sending a single space.{
"text": " ",
"previous_text": "Optional previous sentence",
"next_text": "Optional next sentence",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0.3,
"use_speaker_boost": true
},
"generation_config": {
"synthesisSchedule": [120, 160, 250, 290]
}
}stability, similarity_boost and style range from 0..1. generation_config.synthesisSchedule is an array of positive integers controlling when accumulated text triggers generation. Test the schedule for latency and quality. The example is not a fixed server default.{
"text": "Hello world.",
"earlyGeneration": false
}{
"text": ""
}isFinal=true or is_final=true.{
"text": "",
"flush": true
}flush=true requests output for buffered text and may return audio without final. To finish the task, send {"text":""} as in the previous step and wait for final.{
"audio": "BASE64_AUDIO_DATA",
"isFinal": false
}{
"audio": "",
"isFinal": true
}audio contains Base64-encoded audio. Direct streaming may also return binary frames.directStreaming=true, the service may return JSON with Base64 audio. Handle the actual frame type.isFinal and is_final.audio may be empty, absent or null. The task has still completed successfully.isFinal=null does not signal completion.timestamps, alignment, normalizedAlignment or normalized_alignment.error and message. Handle unfamiliar codes and retain error details for troubleshooting.connect -> initialize -> send text fragment(s) -> {"text":""} -> wait final -> disconnectisFinal=true or is_final=true signals successful synthesis for the task.1006 or no formal Close frame. The completed audio remains valid.Finish succeeded, a later Close cleanup error indicating a closed connection does not invalidate the synthesis. Do not replay the text.| Location | Parameter | Type | Required | Description |
|---|---|---|---|---|
| Query | model_id | string | Yes | TTS model ID. Choose a model supported by this protocol. Allowed values: flash_v2_5, multilingual_v2. |
| Query | priority | string | Yes | Dedicated concurrency is required. Allowed values: dedicated_concurrency. |
| Query | format | string | Yes | Output audio format. Select one of the supported values. Allowed values: mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100, ulaw_8000. |
| Query | idleTimeout | integer | No | Idle timeout in seconds. Range: 1–180. |
| Query | language_code | string | No | Optional language code. Standard TTS supports 29 languages with multilingual_v2 and 32 with flash_v2_5. Check availability for your model. Allowed values: en, ja, zh, de, hi, fr, ko, pt, it, es, id, nl, tr, fil, pl, sv, bg, ro, ar, cs, el, fi, hr, ms, sk, da, ta, uk, ru, hu, no, vi. |
| Query | Timestamps | boolean | No | Request timestamps or alignment information. |
| Query | directStreaming | boolean | No | Request direct audio streaming. Accept both JSON with Base64 audio and binary WebSocket frames. |
| Query | seed | integer | No | An integer seed helps reproduce similar results. Identical audio is not guaranteed. Range: 0–4294967295. Example value: 12345. |
| Query | auto_mode | boolean | No | Enable automatic realtime generation. |
| Path | voice_id | string | Yes | MyVocal voice ID. |
| Header | api-key | string | Yes | MyVocal enterprise API key, sent in the WebSocket handshake header. |