Zum Hauptinhalt springen
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

Die Kling TTS (Text-to-Speech) API bietet hochwertige Text-zu-Sprache-Dienste und unterstützt mehrere Sprachen sowie verschiedene Stimmenoptionen.

Referenzdokumentation


Häufige Probleme

⚠️ Voice id not found-Fehler

Problembeschreibung: Wenn voice_id nicht zu voice_language passt, gibt die API den folgenden Fehler zurück:
{
  "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"
  }
}
Lösung: Bitte stellen Sie sicher, dass die ausgewählte voice_id Ihre angegebene voice_language unterstützt. In der Voice ID-Liste können Sie prüfen, welche Sprachen von den einzelnen Voice IDs unterstützt werden.

Autorisierungen

Authorization
string
header
erforderlich

Bearer token authentication. Use your CometAPI key.

Header

Content-Type
string

Content type of the request body.

Body

application/json
text
string
Standard:Hello
erforderlich

Text to synthesize into speech. Max 1000 characters.

voice_id
string
Standard:example
erforderlich

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
Standard:example
erforderlich

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.

Antwort

200 - application/json

Success

The response is of type object.