CometAPI の POST /grok/v1/videos/generations を使用して Grok で動画を作成し、プロンプトで入力画像をアニメーション化し、request_id を使って結果をポーリングします。
curl --request POST \
--url https://api.cometapi.com/grok/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A candle flickers on a wooden table."
}
'{
"request_id": "4b2cd27e-0b0d-3dec-c31c-7572daf74bb3"
}request_id が返されるため、非同期ワークフローの最初のステップとして扱ってください。
model: grok-imagine-video を使用しますduration は 1、resolution は 480p のままにしますimage.url を追加しますdata:image/png;base64,<BASE64_IMAGE_DATA> のままにしてください完了までポーリング
done になるまで 動画生成結果を取得 を呼び出します。Bearer token authentication. Use your CometAPI key.
Prompt for the video job.
"A candle flickers on a wooden table."
Output aspect ratio.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. xAI documents a range of 1 to 15 seconds.
Optional source image for image-to-video.
Show child attributes
xAI video model id.
"grok-imagine-video"
Show child attributes
Output resolution.
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
Request accepted.
Deferred request id used for polling.
curl --request POST \
--url https://api.cometapi.com/grok/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A candle flickers on a wooden table."
}
'{
"request_id": "4b2cd27e-0b0d-3dec-c31c-7572daf74bb3"
}