Generate speech from text
April 18, 2025
Table of contents
This endpoint generates speech from text using Kling’s text-to-speech technology.
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
API token
is required, see Setup useapi.net for details.
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 from0.8
to2.0
. Default is1.0
.emotion
is optional, must be one of the supported emotion keys for the selected voice.
Responses
-
{ "resource": "https://s21-kling.klingai.com/....mp3", "status": 99, "status_name": "succeed", "status_final": true }
-
{ "error": "Unable to locate speakerId" }
-
{ "error": "Unauthorized", "code": 401 }
Field resource
will contain URL with generated mp3 audio file.
Model
{ // TypeScript, all fields are optional
resource: string
status: number
status_name: string
status_final: boolean
}
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())