الانتقال إلى المحتوى الرئيسي
POST
cURL
أرسل Prompt إلى POST /text-to-video/{model} لإنشاء مهمة فيديو. تحتوي الاستجابة على id تستخدمه لاسترجاع النتيجة.

اختيار نموذج

ضع معرّف النموذج في عنوان URL. لا تضف حقل النموذج إلى متن JSON.

معلمات الطلب

kling-4.0 لا يتيح مفتاح settings.audio. تتضمن مقاطع الفيديو الخاصة به مسارًا صوتيًا؛ احذف الحقل بدلًا من إرسال قيمة يتجاهلها النموذج. ينشئ الطلب التالي فيديو مدته خمس ثوانٍ باستخدام kling-3.0-turbo:
أرسل هذا المتن إلى https://api.cometapi.com/text-to-video/kling-3.0-turbo باستخدام مفتاح CometAPI API الخاص بك. توفر لوحة كود OpenAPI طلبات Shell وPython وJavaScript بالمتن نفسه.

استرجاع الفيديو

تأتي استجابة الإنشاء بالشكل التالي:
احفظ data.id. استخدم الحصول على مهمة Kling باستخدام ذلك المعرّف إلى أن تصل المهمة إلى حالة نهائية. اقرأ عنوان URL للفيديو من مصفوفة outputs الخاصة بالمهمة.

التفويضات

Authorization
string
header
مطلوب

Authenticate with your CometAPI API key.

معلمات المسار

model
enum<string>
افتراضي:kling-3.0-turbo
مطلوب

Kling model ID. kling-4.0 accepts 3-30 second durations and the 21:9 ratio. kling-3.0 supports 4k resolution. The 2.x models accept 5- or 10-second duration.

الخيارات المتاحة:
kling-4.0,
kling-3.0-turbo,
kling-3.0,
kling-2.6,
kling-2.5-turbo

الجسم

application/json

Text-to-video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.

prompt
string
مطلوب

Text description of the video to generate.

Minimum string length: 1
settings
object

Video generation settings exposed by the CometAPI route. The model ID in the URL determines which values are accepted.

options
object

Optional task fields exposed by the CometAPI route.

الاستجابة

200 - application/json

The task was created. Use data.id to retrieve its status and video output.

code
مطلوب

Request result code. 0 or success indicates acceptance.

message
string
مطلوب

Result message.

data
object
مطلوب

Task identifier and submission status.

msg
string

Additional result message when included in the response.

آخر تعديل في ١٣ نوفمبر ٢٠٢٦