xAI
動画生成
CometAPI の POST /grok/v1/videos/generations を使用して Grok で動画を生成し、プロンプトで入力画像をアニメーション化し、request_id で結果をポーリングします。
POST
このエンドポイントを使用すると、テキスト、またはテキストと1枚の元画像から Grok の動画ジョブを開始できます。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
request_id が即座に返されるため、非同期ワークフローの最初のステップとして扱ってください。
小さなリクエストから始める
model: grok-imagine-videoを使用します- 最初のリクエストでは、
durationは1、resolutionは480pのままにします - 画像から動画を生成したい場合にのみ
image.urlを追加します - base64 を送信する場合は、ドキュメントと OpenAPI の例の形式を
data:image/png;base64,<BASE64_IMAGE_DATA>のまま使用します
タスクの流れ
完了までポーリング
ネストされたプロバイダーの status が
done になるまで、動画生成結果を取得 を呼び出します。承認
Bearer token authentication. Use your CometAPI key.
ボディ
application/json
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.
xAI video model id.
例:
"grok-imagine-video"
Output resolution.
利用可能なオプション:
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
レスポンス
200 - application/json
Request accepted.
Deferred request id used for polling.