Skip to main content
POST
cURL

TTS

Kling TTS(文字轉語音)API 提供高品質的文字轉語音服務,支援多種語言與聲音選項。

參考文件


常見問題

Voice id not found 錯誤

問題描述:當 voice_idvoice_language 不相符時,API 會回傳以下錯誤:
解決方案:請確認所選的 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
必填

Text to synthesize into speech. Max 1000 characters.

voice_id
string
必填

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
必填

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

code
integer
必填

Response code. 0 means the task request was accepted.

message
string
必填

Response message.

data
object
必填
request_id
string

Request identifier returned by CometAPI when present.