Przejdź do głównej treści
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) zapewnia wysokiej jakości usługi zamiany tekstu na mowę, obsługując wiele języków i opcji głosowych.

Dokumentacja referencyjna


Typowe problemy

⚠️ Błąd Voice id not found

Opis problemu: Gdy voice_id nie jest zgodny z voice_language, API zwróci następujący błąd:
{
  "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"
  }
}
Rozwiązanie: Upewnij się, że wybrany voice_id obsługuje określony przez Ciebie voice_language. Sprawdź Voice ID List, aby zobaczyć, które języki obsługuje każdy Voice ID.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI key.

Nagłówki

Content-Type
string

Content type of the request body.

Treść

application/json
text
string
domyślnie:Hello
wymagane

Text to synthesize into speech. Max 1000 characters.

voice_id
string
domyślnie:example
wymagane

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
domyślnie:example
wymagane

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.

Odpowiedź

200 - application/json

Success

The response is of type object.