Generate speech from text

April 18, 2025

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

This endpoint generates speech from text using Kling’s text-to-speech technology.

You can execute an unlimited number of TTS generations for free. This feature is available for all Kling subscription plans, including the free one.

https://api.useapi.net/v1/kling/tts/create

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
  "email": "[email protected]",
  "speakerId": "speakerId",
  "text": "Text to be converted to speech",
  "speed": 1.0,
  "emotion": "happy"
}
  • email is optional when only one account configured.
    However, if you have multiple accounts configured, this parameter becomes required.

  • speakerId is required, a valid speakerId from GET /tts/voices.

  • text is required, the text to be converted to speech.

  • speed is optional, range from 0.8 to 2.0.
    Default is 1.0.

  • emotion is optional, must be one of the supported emotion keys for the selected voice.

Responses
  • 200 OK

    {
      "resource": "https://s21-kling.klingai.com/....mp3",
      "status": 99,
      "status_name": "succeed",
      "status_final": true
    }
    
  • 400 Bad Request

    {
      "error": "Unable to locate speakerId"
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    

Field resource will contain URL with generated mp3 audio file.

Model
{ // TypeScript, all fields are optional
  resource: string        // URL to the generated MP3 audio file
  status: number          // Status code, e.g., 99 for succeed
  status_name: 'submitted' | 'failed' | 'processing' | 'succeed'  // Status name
  status_final: boolean   // Whether this is the final status
}
Examples
  • curl -X POST "https://api.useapi.net/v1/kling/tts/create" \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer …" \
       -d '{"email":"[email protected]","speakerId":"speakerId","text":"Hello, world!"}'
    
  • const token = "API token";
    const email = "Previously configured account email";
    const apiUrl = "https://api.useapi.net/v1/kling/tts/create"; 
    const response = await fetch(apiUrl, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${token}`,
      },
      body: JSON.stringify({
        email: email,
        speakerId: "speakerId",
        text: "Hello, world!"
      })
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    email = "Previously configured account email"
    apiUrl = "https://api.useapi.net/v1/kling/tts/create"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    data = {
        "email": email,
        "speakerId": "speakerId",
        "text": "Hello, world!"
    }
    response = requests.post(apiUrl, headers=headers, json=data)
    print(response, response.json())
    
Try It