通过 CometAPI POST /kling/v1/audio/tts 调用 Kling TTS,将文本转换为语音,支持多语言音色,并提供 voice_id not found 错误的解决方法。
curl --request POST \
--url https://api.cometapi.com/kling/v1/audio/tts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh"
}
'{}voice_id 与 voice_language 不匹配时,API 将返回以下错误:
{
"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 支持你指定的 voice_language。参考 Voice ID 列表 查看每个 Voice ID 支持哪些语言。Bearer token authentication. Use your CometAPI key.
Content type of the request body.
Text to synthesize into speech. Max 1000 characters.
Voice preset ID. Determines the speaker voice used for synthesis. See the Kling documentation for available voice IDs and their supported languages.
Language of the selected voice. Must match the language supported by the chosen voice_id. Values: zh (Chinese) or en (English).
Speech rate multiplier. Range 0.8–2.0 (one decimal place). Values outside this range are clamped automatically.
Success
The response is of type object.
curl --request POST \
--url https://api.cometapi.com/kling/v1/audio/tts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Welcome to CometAPI!",
"voice_id": "genshin_vindi2",
"voice_language": "zh"
}
'{}