إنشاء فيديو xAI
استخدم CometAPI POST /grok/v1/videos/generations لإنشاء مهام Grok لتحويل الصورة إلى فيديو من صورة إدخال وPrompt، ثم استطلع النتائج عبر request_id.
request_id فورًا، لذا تعامل معها على أنها الخطوة الأولى في سير عمل غير متزامن.
ابدأ بطلب صغير
- استخدم
model: grok-imagine-video-1.5 - اضبط
image.urlعلى رابط URL عام بصيغة JPEG أو PNG أو WebP - في أول طلب، أبقِ
durationعند1وresolutionعند720p - اجعل
promptواضحًا بحيث يكون اتجاه التحريك مفهومًا - إذا أرسلت base64، فأبقِ صيغة المستندات ومثال OpenAPI كما هي:
data:image/png;base64,<BASE64_IMAGE_DATA>
المدة والدقة
تدفق المهمة
إنشاء المهمة
request_id المُعاد.استطلاع الاكتمال
done.الاحتفاظ بالمخرجات
video.url النهائي إلى مساحة التخزين الخاصة بك إذا كنت تحتاج إليه بعد نافذة التسليم المؤقتة الخاصة بالمزوّد.التفويضات
Bearer token authentication. Use your CometAPI key.
الجسم
Prompt describing how the source image should animate. CometAPI requires this field for this route.
"Animate the still image with a slow camera move and natural motion."
Output aspect ratio. Combine with resolution to choose the target frame; for example 480p with 1:1 targets 480x480, 720p with 16:9 targets 1280x720, and 720p with 9:16 targets 720x1280. This endpoint does not expose an exact size field.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. Use an integer from 1 through 15. If omitted, CometAPI treats the request as an 8-second generation for billing and default handling.
Source image for image-to-video. Use a public JPEG, PNG, or WebP URL, or a data URI such as data:image/png;base64,<BASE64_IMAGE_DATA>.
xAI video model id. The default example uses Grok Imagine 1.5 for image-to-video.
"grok-imagine-video-1.5"
Output resolution. Use 720p for a small image-to-video test, or 1080p when you need a higher resolution tier.
480p, 720p, 1080p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
الاستجابة
Request accepted.
Deferred request id used for polling.