WSS wss://api.async.ai/text_to_speech/websocket/ws
Name | Type | Required | Description |
---|---|---|---|
api_key | string | Yes | Async API key. |
version | string | Yes | API version |
object
— RequiredProperty | Type | Required | Description |
---|---|---|---|
model_id | string | Yes | Model ID (example: "asyncflow_v2.0") |
voice | object | Yes | Dictionary with keys "mode" and "id". (example: {"mode": "id", "id": "e0f39dc4-f691-4e78-bba5-5c636692cc04"} |
output_format | object | No | Dictionary with keys "container" , "encoding", "sample_rate", "bit_rate". Defualts to {container="raw", encoding="pcm_s16le", sample_rate=44100} |
language | string | No | Generated speech langauge |
object
— RequiredProperty | Type | Required | Description |
---|---|---|---|
transcript | string | Yes | New text chunk—always ends with a single space. |
force | boolean | No | Force the TTS even if there is not enough characters in the buffer. Defaults to False. |
object
— RequiredProperty | Type | Required | Description |
---|---|---|---|
text | string | Yes | Empty string to finish. |
object
— streamedField | Type | Required | Description |
---|---|---|---|
audio | string | Yes | Base-64 audio chunk. |
final | boolean | Yes | Whether this is the final response for the request |
object
Field | Type | Required | Notes |
---|---|---|---|
audio | string | Yes | Always "". |
final | boolean | Yes | Always true ; generation complete. |
object
Field | Type | Required | Notes |
---|---|---|---|
error_code | string | Yes | Error code identifying the type of error |
message | string | Yes | Human-readable error message |
extra | Object | No | Additional error details |
/text_to_speech/websocket/ws
{"model_id": "asyncflow_v2.0",...
{
"model_id": "asyncflow_v2.0",
"voice": {
"mode": "id",
"id": "e0f39dc4-f691-4e78-bba5-5c636692cc04"
},
"output_format": {
"container": "raw",
"encoding": "pcm_f32le",
"sample_rate": 44100
}
}
{"text":"Welcome to Async."}
{"text":"Welcome to Async."}
{"text":""}
{ "text": "" }
{"audio":"Y3Vya...",...}
{
"audio": "Y3VyaW91cyBtaW5kcyB0aGluayBhbGlrZSA6KQ==",
"final": false,
}
{"audio":"", "final":true}
{ "audio": "", "final": true }