Grokで動画を作成
テキスト、ソース画像、または画像およびプリセット音声の参照入力から、非同期 Grok Imagine Video 1.5 ジョブを作成します。
request_id がすぐに返されるため、非同期ワークフローの最初のステップとして扱ってください。
常に model: grok-imagine-video-1.5 を明示的に送信してください。model と prompt は、ここで説明する 1.5 のリクエスト形式で必須です。
入力モードを選択する
data:image/png;base64,<BASE64_IMAGE_DATA> を使用します。各 reference_images 項目では同じ url フィールドを使用します。参照オーディオ項目では、voice_id などのプリセット eve を使用します。プロンプトでは、<IMAGE_0> や <AUDIO_0> などのタグで対応する参照を識別できます。
小規模なリクエストから始める
model: grok-imagine-video-1.5を使用する- 最初のリクエストでは、
durationを1に、resolutionを480pに設定します。 promptを明示的に指定して、シーンと動きを明確にします- 参照画像と音声を組み合わせる前に、入力モードは一度に 1 つずつ追加します
長さと解像度
duration、resolution、aspect_ratio を明示的に設定してください。
タスクフロー
ジョブを作成
request_id を保存します。完了するまでポーリングする
status が done、failed、または expired になるまで呼び出します。タスクメタデータの準備中は、初期レスポンスにエコーバックされた request_id のみが含まれる場合があります。出力を保存
video.url を自分のストレージにコピーしてください。承認
Use your CometAPI API key as the bearer value.
ボディ
The Grok video model ID. Send this field explicitly so the request uses Grok Imagine Video 1.5.
grok-imagine-video-1.5 "grok-imagine-video-1.5"
A description of the scene, motion, and audio. Reference-to-video prompts can identify inputs with tags such as <IMAGE_0> and <AUDIO_0>.
1"A paper boat glides across a quiet pond at sunrise."
The output duration in seconds. Use an integer from 1 through 15.
1 <= x <= 15The output aspect ratio. Text-to-video uses 16:9 when omitted. Image-to-video uses the source image's aspect ratio when omitted.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 "16:9"
The output resolution. Reference-to-video requests support 480p and 720p; text-to-video and image-to-video also support 1080p.
480p, 720p, 1080p The source image for image-to-video. Do not combine this field with reference_images or reference_audios.
Visual references for reference-to-video. Each item accepts a public image URL or image data URI. Do not combine this field with image.
1 - 7 elementsPreset voice references for reference-to-video. Do not combine this field with image.
1 - 3 elementsレスポンス
Request accepted.
The deferred request ID used to poll GET /grok/v1/videos/{request_id}.