跳转到主要内容
POST
/
kling
/
v1
/
audio
/
tts
TTS
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"
}
'
{}

TTS

Kling TTS(文本转语音)API 提供高质量的文本转语音服务,支持多种语言和音色选项。

参考文档


常见问题

⚠️ Voice id not found 错误

问题描述: 当 voice_idvoice_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 支持哪些语言。

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求头

Content-Type
string

Content type of the request body.

请求体

application/json
text
string
默认值:Hello
必填

Text to synthesize into speech. Max 1000 characters.

voice_id
string
默认值:example
必填

Voice preset ID. Determines the speaker voice used for synthesis. See the Kling documentation for available voice IDs and their supported languages.

voice_language
string
默认值:example
必填

Language of the selected voice. Must match the language supported by the chosen voice_id. Values: zh (Chinese) or en (English).

voice_speed
number

Speech rate multiplier. Range 0.8–2.0 (one decimal place). Values outside this range are clamped automatically.

响应

200 - application/json

Success

The response is of type object.