Generate speech from text
April 18, 2025 (November 16, 2026)
Table of contents
This endpoint generates speech up to 5 minutes long 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
API tokenis required, see Setup useapi.net for details.
Request Body
{
"email": "user@example.com",
"speakerId": "speakerId",
"text": "Text to be converted to speech",
"speed": 1.0,
"emotion": "happy"
}
-
emailis optional. Leave it out and the job goes to one of your accounts that has a free job slot, picked at random. Each account runs at most itsmaxJobsjobs at once, and GET scheduler/available shows the free slots. If no account has a free slot, the response is429.
Passemailto run the job on that account (429if it is busy). Uploaded files, elements, voices, avatars and earlier tasks belong to one account, so pass theemailof the account they came from. -
speakerIdis required, a valid speakerId from GET /tts/voices. -
textis required, the text to be converted to speech. -
speedis optional, range from0.8to2.0.
Default is1.0. -
emotionis optional, must be one of the supported emotion keys for the selected voice.
Responses
-
{ "resource": "https://s21-kling.klingai.com/....mp3", "status": 99, "duration": 195621, "status_name": "succeed", "status_final": true } -
{ "error": "<error message>" }Kling refused the text under its content rules.
errorcarries Kling’s own message:{ "error": "The description contains content that violates our guidelines. Please revise it and try again. If you have any questions, please contact customer support. (CM_EXT.Other)", "message": "The description contains content that violates our guidelines. Please revise it and try again. If you have any questions, please contact customer support. (CM_EXT.Other)" } -
{ "error": "Unauthorized", "code": 401 } -
Kling uses a
500response to indicate moderation and other issues with the input. It may be hard to separate actual 500 errors from moderation errors, so use theerrorfield text and your best judgement to tell them apart, since themessagefield most often has very generic and perhaps misleading text.{ "error": "The content you uploaded appears to violate the community guidelines. (CM_EXT.POther)", "message": "Service busy (CM_EXT.POther)" }
Field resource will contain URL with generated mp3 audio file.
Model
The finished speech: the URL of the MP3 file in resource, with its duration and final status.
The generated speech, field by field
{ // TypeScript, all fields are optional
resource: string // URL to the generated MP3 audio file
status: number // Status code, e.g., 99 for succeed
duration: number // Duration, seconds
status_name: 'submitted' | 'failed' | 'processing' | 'succeed' // Status name
status_final: boolean // Whether this is the final status
message: string
error: string
}
Examples
-
curl -X POST "https://api.useapi.net/v1/kling/tts/create" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{"email":"user@example.com","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())