Manage independent speech tasks on one connection. Identify each task by context_id.
multilingual_v2 and flash_v2_5.Connect → initialize a context → send text → flush → close_context → wait for context finalwss://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket/multiwss://api.us.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket/multiwss://api.eu.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket/multiwss://api.jp.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket/multi{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.pcm_16000. See the parameter table for supported values.20, range 1..180.en or zh.0..4294967295. A seed improves consistency with identical settings. Byte-identical audio is not guaranteed.format. If your SDK exposes output_format, use that option and avoid supplying conflicting values.wss://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket/multi?model_id=flash_v2_5&priority=dedicated_concurrency&format=pcm_16000&idleTimeout=20&language_code=zhcontext_id is required.voice_settings, previous_text, next_text and generation_config in the initialization message.voice_settings only in the first message for that context.close_context, then wait for that context’s final event.close_context does not implicitly flush. Closing without flushing interrupts or cancels the task and may discard buffered audio.{
"context_id": "ctx_001",
"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.{
"context_id": "ctx_001",
"text": "Hello world.",
"flush": false
}{
"context_id": "ctx_001",
"text": "",
"flush": true
}{
"context_id": "ctx_001",
"close_context": true
}is_final=true or isFinal=true for that context.close_context=true. This ends the context. Any text that has not been flushed may be only partially rendered.{
"context_id": "ctx_001",
"text": ""
}{
"close_socket": true
}{
"context_id": "ctx_001",
"audio": "BASE64_AUDIO_DATA",
"is_final": false
}{
"context_id": "ctx_001",
"is_final": true
}context_id and contextId, and both is_final and isFinal.null audio. It still signals successful completion for that context.audio is Base64. Binary frames may also arrive. Only route binary audio to a context when the protocol identifies the context it belongs to.timestamps or alignment.error and message. Handle unfamiliar codes and retain error details for troubleshooting.connect -> initialize context -> send text -> flush -> close_context -> wait context final| 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 | No | The wire parameter is format and defaults to pcm_16000. Some SDKs call this option output_format. 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 | Context idle timeout in seconds. Default: 20. 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. |