跳轉到主要內容
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 List 來查看各個 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.