Chuyển đến nội dung chính
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

API Kling TTS (Text-to-Speech) cung cấp dịch vụ chuyển văn bản thành giọng nói chất lượng cao, hỗ trợ nhiều ngôn ngữ và tùy chọn giọng đọc.

Tài liệu tham khảo


Các vấn đề thường gặp

⚠️ Lỗi không tìm thấy Voice id

Mô tả sự cố: Khi voice_id không khớp với voice_language, API sẽ trả về lỗi sau:
{
  "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"
  }
}
Giải pháp: Vui lòng đảm bảo rằng voice_id đã chọn hỗ trợ voice_language mà bạn chỉ định. Tham khảo Danh sách Voice ID để kiểm tra mỗi voice ID hỗ trợ những ngôn ngữ nào.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Tiêu đề

Content-Type
string

Content type of the request body.

Nội dung

application/json
text
string
mặc định:Hello
bắt buộc

Text to synthesize into speech. Max 1000 characters.

voice_id
string
mặc định:example
bắt buộc

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
mặc định:example
bắt buộc

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.

Phản hồi

200 - application/json

Success

The response is of type object.