Kling
Create Kling speech
Call Kling TTS via CometAPI POST /kling/v1/audio/tts to convert text to speech with multilingual voices, plus fixes for voice_id not found errors.
POST
/
kling
/
v1
/
audio
/
tts
cURL
curl https://api.cometapi.com/kling/v1/audio/tts \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/audio/tts",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
},
)
result = response.json()
print(result["code"], result.get("data", {}).get("task_id")) # the route responds with the result payload directly
const response = await fetch("https://api.cometapi.com/kling/v1/audio/tts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
}),
});
const result = await response.json();
console.log(result.code, result.data?.task_id); // the route responds with the result payload directly
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/audio/tts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Welcome to CometAPI!',
'voice_id' => 'genshin_vindi2',
'voice_language' => 'zh'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/kling/v1/audio/tts"
payload := strings.NewReader("{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/kling/v1/audio/tts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/audio/tts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "<task_id>",
"task_status": "submitted",
"task_info": {},
"task_status_msg": null,
"created_at": 1773366840306,
"updated_at": 1773366840306
}
}TTS
The Kling TTS (Text-to-Speech) API provides high-quality text-to-speech services, supporting multiple languages and voice options.Reference documentation
- API Reference: Kling TTS API Documentation
- Voice ID List: Available Voice ID Reference
Common issues
Voice id not found error
Issue Description: Whenvoice_id does not match voice_language, the API will return the following error:
{
"message": "Voice id not found",
"data": {
"data": {
"code": 1201,
"message": "Voice id not found",
"request_id": "ed47a82c-804b-45f3-bde9-926039cd25c0"
},
"message": "Voice id not found"
}
}
voice_id supports your specified voice_language. Refer to the Voice ID List to check which languages each voice ID supports.Body
application/json
Text to synthesize into speech. Max 1000 characters.
Last modified on June 23, 2026
⌘I
cURL
curl https://api.cometapi.com/kling/v1/audio/tts \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/audio/tts",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
},
)
result = response.json()
print(result["code"], result.get("data", {}).get("task_id")) # the route responds with the result payload directly
const response = await fetch("https://api.cometapi.com/kling/v1/audio/tts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh",
"voice_speed": 1.2
}),
});
const result = await response.json();
console.log(result.code, result.data?.task_id); // the route responds with the result payload directly
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/audio/tts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Welcome to CometAPI!',
'voice_id' => 'genshin_vindi2',
'voice_language' => 'zh'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/kling/v1/audio/tts"
payload := strings.NewReader("{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/kling/v1/audio/tts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/audio/tts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Welcome to CometAPI!\",\n \"voice_id\": \"genshin_vindi2\",\n \"voice_language\": \"zh\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "<task_id>",
"task_status": "submitted",
"task_info": {},
"task_status_msg": null,
"created_at": 1773366840306,
"updated_at": 1773366840306
}
}