Skip to main content
POST
cURL

TTS

توفّر واجهة برمجة تطبيقات Kling TTS ‏(Text-to-Speech) خدمات تحويل النص إلى كلام بجودة عالية، مع دعم عدة لغات وخيارات صوتية متعددة.

الوثائق المرجعية


المشكلات الشائعة

خطأ voice id not found

وصف المشكلة: عندما لا يتطابق voice_id مع voice_language، ستُرجع واجهة برمجة التطبيقات الخطأ التالي:
الحل: يُرجى التأكد من أن 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.