Speech Synthesis API
Updated: 2026-07-14
- Call speech synthesis with an API Key to convert text into audio.
- This endpoint creates and processes the task synchronously. On success, it returns
taskId, targetAudioUrl, and audio-related information. - The user identity is resolved from the API Key. Do not pass user ID, channel, or source fields.
The examples in this document use:
https://video-translation.viitor.com
All OpenAPI requests must include the API Key in the request header:
Authorization: Bearer vt_live_xxx
Notes:
- API Keys can be created in the console.
- The account must have an active plan that includes API access when creating and calling an API Key.
- The account must remain in VIP status when calling the API, otherwise the API returns a permission error.
- The full API Key is displayed only once after creation. Store it securely.
| Field | Type | Description |
|---|
code | Integer | 0 means success; non-zero means failure |
message | String | Response message |
data | Object | Business data |
- Request URL:
https://video-translation.viitor.com/openapi/v1/speech-synthesis/textToSpeech - Method:
POST - Content-Type:
application/json - Response structure:
{code, message, data}
| Header | Required | Type | Description |
|---|
Content-Type | Yes | String | application/json;charset=UTF-8 |
Accept | Recommended | String | application/json;charset=UTF-8 |
Authorization | Yes | String | Bearer <API_KEY> |
| Field | Type | Required | Description |
|---|
sourceText | String | Yes | Text to synthesize. If it exceeds 5000 characters, the server truncates it to the first 5000 characters |
voiceName | String | Yes | Voice identifier. You can get it from the OpenAPI timbre list endpoint |
emotion | Integer | No | Emotion enum. Default: 0. See the emotion enum below |
format | String | No | Audio format: wav, mp3, pcm. Defaults to wav if omitted or invalid |
speed | Float | No | Speech speed multiplier. Default: 1.0. Range: 0.5 to 2.0 |
loudnessLufs | Float | No | Loudness parameter. Range: -30 to -6 |
| Value | Description |
|---|
0 | Default, default |
2 | Angry, angry |
3 | Sad, sad |
4 | Happy, happy |
5 | Fearful, fearful |
6 | Surprised, surprised |
sourceText is required.voiceName is required. You can get it from the OpenAPI timbre list endpoint.- The OpenAPI speech synthesis endpoint does not support translation synthesis. Do not pass
targetLanguage. format only supports wav, mp3, and pcm. It defaults to wav if omitted or invalid.speed must be between 0.5 and 2.0. Default: 1.0.loudnessLufs must be between -30 and -6.emotion supports 0, 2, 3, 4, 5, and 6. Default: 0.
| Field | Type | Description |
|---|
userId | Long | User ID bound to the API Key |
taskId | String | Task ID |
targetAudioUrl | String | Synthesized audio URL |
loudnessLufs | Float | Loudness parameter |
speed | Float | Speech speed parameter |
fileFormat | String | File format |
curl -X POST "https://video-translation.viitor.com/openapi/v1/speech-synthesis/textToSpeech" \
-H "Content-Type: application/json" \
-H "Accept: application/json;charset=UTF-8" \
-H "Authorization: Bearer vt_live_xxx" \
-d '{
"sourceText": "Welcome to ViiTor AI.",
"voiceName": "alloy",
"emotion": 0,
"speed": 1.0,
"loudnessLufs": -18,
"format": "mp3"
}'
{
"code": 0,
"message": "OK",
"data": {
"userId": 123456,
"taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA",
"targetAudioUrl": "https://cdn.example.com/audio/result.mp3",
"fileFormat": "mp3"
}
}
| code | message | Description |
|---|
0 | OK | Success |
1103 | No Privilege | The account is not VIP or has no permission to call the API |
2001 | Invalid Parameter | Invalid parameter, such as empty text, missing voice, or out-of-range parameter |
400001 | missing_api_key | Missing API Key |
400002 | invalid_api_key | Invalid API Key |
400003 | disabled_api_key | API Key is disabled |
400004 | expired_api_key | API Key has expired |