The Kling 3.0 series models API is now fully available
Learn More

TTS


Create Task

POST/v1/audio/tts
curl --request POST \
  --url https://api-singapore.klingai.com/v1/audio/tts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "text": "Throughout my time in college, several memorable event left a significant impact on my life",
    "voice_id": "oversea_male1",
    "voice_language": "en",
    "voice_speed": 1
  }'
200
{
  "code": 0, // Error codes; Specific definitions can be found in Error codes
  "message": "string", // Error information
  "request_id": "string", // Request ID, generated by the system, is used to track requests and troubleshoot problems
  "data": {
    "task_id": "string", // Task ID, generated by the system
    "task_status": "string", // Task status, Enum values: submitted, processing, succeed, failed
    "task_status_msg": "string", // Task status information, displaying the failure reason when the task fails (such as triggering the content risk control of the platform, etc.)
    "task_result": {
      "audios": [
        {
          "id": "string", // Generated sound ID; globally unique, will be cleared after 30 days
          "url": "string", // URL for generating sounds,such as https://p1.a.kwimgs.com/bs2/upload-ylab-stunt/special-effect/output/HB1_PROD_ai_web_46554461/-2878350957757294165/output.mp3(To ensure information security, generated images/videos will be cleared after 30 days. Please make sure to save them promptly.)
          "duration": "string" // Total audio duration, unit: s (seconds)
        }
      ]
    },
    "final_unit_deduction": "string", // The deduction units of task
    "created_at": 1722769557708, // Task creation time, Unix timestamp, unit: ms
    "updated_at": 1722769557708 // Task update time, Unix timestamp, unit: ms
  }
}

Text-to-Speech synthesis API for generating audio from text.

Request Header

Content-TypestringRequiredDefault to application/json

Data Exchange Format

AuthorizationstringRequired

Authentication information, refer to API authentication

Request Body

textstringRequired

Text Content for Audio Synthesis

  • The maximum length of the text content is 1000 characters; content that is too long will return an error code and other information.
  • The system will validate the text content; if there are issues, it will return an error code and other information.
voice_idstringRequired

Voice ID

  • The system offers a variety of voice options to choose from. For specific voice effects, voice IDs, and corresponding voice languages, see Voice Guide. Voice previews do not support custom scripts.
  • Voice preview file naming convention: Voice Name#Voice ID#Voice Language
voice_languagestringRequiredDefault to zh

Voice Language

Enum values:zhen
  • The voice language corresponds to the Voice ID, as detailed above.
voice_speedfloatOptionalDefault to 1.0

Speech Rate

  • Valid range: [0.8, 2.0], accurate to one decimal place; values outside this range will be automatically rounded.
curl --request POST \
  --url https://api-singapore.klingai.com/v1/audio/tts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "text": "Throughout my time in college, several memorable event left a significant impact on my life",
    "voice_id": "oversea_male1",
    "voice_language": "en",
    "voice_speed": 1
  }'
200
{
  "code": 0, // Error codes; Specific definitions can be found in Error codes
  "message": "string", // Error information
  "request_id": "string", // Request ID, generated by the system, is used to track requests and troubleshoot problems
  "data": {
    "task_id": "string", // Task ID, generated by the system
    "task_status": "string", // Task status, Enum values: submitted, processing, succeed, failed
    "task_status_msg": "string", // Task status information, displaying the failure reason when the task fails (such as triggering the content risk control of the platform, etc.)
    "task_result": {
      "audios": [
        {
          "id": "string", // Generated sound ID; globally unique, will be cleared after 30 days
          "url": "string", // URL for generating sounds,such as https://p1.a.kwimgs.com/bs2/upload-ylab-stunt/special-effect/output/HB1_PROD_ai_web_46554461/-2878350957757294165/output.mp3(To ensure information security, generated images/videos will be cleared after 30 days. Please make sure to save them promptly.)
          "duration": "string" // Total audio duration, unit: s (seconds)
        }
      ]
    },
    "final_unit_deduction": "string", // The deduction units of task
    "created_at": 1722769557708, // Task creation time, Unix timestamp, unit: ms
    "updated_at": 1722769557708 // Task update time, Unix timestamp, unit: ms
  }
}