API Docs Center

Speech Synthesis API


Updated: 2026-07-14

Overview

  • 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.

Base URL

The examples in this document use:

https://video-translation.viitor.com


Authentication

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.

Common Response Structure

FieldTypeDescription
codeInteger0 means success; non-zero means failure
messageStringResponse message
dataObjectBusiness data

1. Text to Speech

Endpoint

  • Request URL: https://video-translation.viitor.com/openapi/v1/speech-synthesis/textToSpeech
  • Method: POST
  • Content-Type: application/json
  • Response structure: {code, message, data}

HTTP Headers

HeaderRequiredTypeDescription
Content-TypeYesStringapplication/json;charset=UTF-8
AcceptRecommendedStringapplication/json;charset=UTF-8
AuthorizationYesStringBearer <API_KEY>

Request Body

FieldTypeRequiredDescription
sourceTextStringYesText to synthesize. If it exceeds 5000 characters, the server truncates it to the first 5000 characters
voiceNameStringYesVoice identifier. You can get it from the OpenAPI timbre list endpoint
emotionIntegerNoEmotion enum. Default: 0. See the emotion enum below
formatStringNoAudio format: wav, mp3, pcm. Defaults to wav if omitted or invalid
speedFloatNoSpeech speed multiplier. Default: 1.0. Range: 0.5 to 2.0
loudnessLufsFloatNoLoudness parameter. Range: -30 to -6

emotion Enum

ValueDescription
0Default, default
2Angry, angry
3Sad, sad
4Happy, happy
5Fearful, fearful
6Surprised, surprised

Parameter Rules

  1. sourceText is required.
  2. voiceName is required. You can get it from the OpenAPI timbre list endpoint.
  3. The OpenAPI speech synthesis endpoint does not support translation synthesis. Do not pass targetLanguage.
  4. format only supports wav, mp3, and pcm. It defaults to wav if omitted or invalid.
  5. speed must be between 0.5 and 2.0. Default: 1.0.
  6. loudnessLufs must be between -30 and -6.
  7. emotion supports 0, 2, 3, 4, 5, and 6. Default: 0.

Successful data Fields

FieldTypeDescription
userIdLongUser ID bound to the API Key
taskIdStringTask ID
targetAudioUrlStringSynthesized audio URL
loudnessLufsFloatLoudness parameter
speedFloatSpeech speed parameter
fileFormatStringFile format

Request Example

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"
  }'

Successful Response Example

{
  "code": 0,
  "message": "OK",
  "data": {
    "userId": 123456,
    "taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA",
    "targetAudioUrl": "https://cdn.example.com/audio/result.mp3",
    "fileFormat": "mp3"
  }
}

Common Error Codes

codemessageDescription
0OKSuccess
1103No PrivilegeThe account is not VIP or has no permission to call the API
2001Invalid ParameterInvalid parameter, such as empty text, missing voice, or out-of-range parameter
400001missing_api_keyMissing API Key
400002invalid_api_keyInvalid API Key
400003disabled_api_keyAPI Key is disabled
400004expired_api_keyAPI Key has expired

© 2026 HighRas Limited