Generate speech from text
April 18, 2025 (October 1, 2025)
Table of contents
This endpoint generates speech up to 15 seconds 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": "[email protected]",
"speakerId": "speakerId",
"text": "Text to be converted to speech",
"speed": 1.0,
"emotion": "happy"
}
-
emailis optional when only one account configured.
However, if you have multiple accounts configured, this parameter becomes required. -
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, "status_name": "succeed", "status_final": true } -
{ "error": "Unable to locate speakerId" } -
{ "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
{ // 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
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":"[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())