Grok Imagine Video
Grok Imagine Video (xAI). Two uses: make a 1-15 second clip at 480p or 720p from text, from one picture as the first frame, or from 2-7 reference pictures (then at most 10 seconds); or edit a video you already have: send one mp4 of at most 8.7 seconds in videos with a prompt saying what to change, and get the same clip back with the change (same length and aspect ratio, up to 720p). Price: 480p $0.044 and 720p $0.0616 per output second, plus $0.00176 per picture; an edit is $0.0704 per second of the source video. For plain generation grok-imagine-1.5-video is 3-4 times cheaper but cannot take a video.
料金
$0.044/秒
エンドポイント
/videos
結果の受け取り方
非同期タスクのライフサイクル
提供状況
現在利用可能
API ドキュメント
リクエストを作成してコピー
このモデルが受け付けるオプションを選んでください。下のコードは選択に合わせて更新されます。
https://www.aisplice.store/v1/videosBearer API key非同期タスクオプションこのモデルで公開されているオプションのみ表示しています。
# Requires curl and jq
API_KEY="${API_KEY:-YOUR_API_KEY}"
# 1. Submit once
SUBMITTED=$(curl --fail-with-body -sS https://www.aisplice.store/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: model-docs-$(date +%s)-$$" \\
-d '{
"model": "Grok Imagine Video",
"prompt": "A cinematic scene with careful composition",
"duration": 8,
"resolution": "480p",
"size": "auto",
"nsfw_check": false
}')
TASK_ID=$(printf '%s' "$SUBMITTED" | jq -r '.task_id // .id // empty')
if [ -z "$TASK_ID" ]; then
printf '%s\n' "$SUBMITTED" >&2
exit 1
fi
echo "task_id=$TASK_ID"
# 2. Poll until terminal
while true; do
STATUS_JSON=$(curl --fail-with-body -sS \
"https://www.aisplice.store/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $API_KEY")
STATUS=$(printf '%s' "$STATUS_JSON" | jq -r '.status // empty' | tr '[:upper:]' '[:lower:]')
echo "status=$STATUS"
case "$STATUS" in
completed|succeeded|success) break ;;
failed|failure|cancelled|canceled)
printf '%s\n' "$STATUS_JSON" | jq .
exit 1
;;
esac
sleep 5
done
# 3. Fetch the final result
curl --fail-with-body -sS \
"https://www.aisplice.store/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $API_KEY" | jq .- 1タスクを送信
- 2ステータスをポーリング
- 3コンテンツを取得
このモデルには公開メディア URL が必要です。 ローカルファイルは先にアップロードし、public_url をモデルのリクエストに指定してください。大きな Base64 のボディは避けてください。
アップロードガイドを読むパラメーターリファレンス
modelこのリクエストで使う正確なモデル識別子。
grok-imagine-videopromptWhat to make; for an edit, what to change and what must stay the same. Up to 8000 characters.
durationOutput seconds, 1 to 15; at most 10 with 2 or more pictures. Not used for an edit: the output is as long as the source video.
resolution480p ($0.044 per second) or 720p ($0.0616 per second). Not used for an edit: the output keeps the source video's resolution, up to 720p.
480p720psizeAspect ratio. With one picture the clip takes the picture's shape. Not used for an edit: the output keeps the source video's.
auto16:99:161:14:33:43:22:3imagesUp to 7 public picture URLs, $0.00176 each. One picture is the first frame; 2 to 7 are references for a clip of at most 10 seconds. Not together with videos.
videosEdit a video: one public mp4 URL of at most 8.7 seconds. You get the same clip back with the change the prompt asks for, at $0.0704 per second of the source video. Not together with images.
レスポンスの流れ
タスクのステータス、終了状態、結果レスポンスの例。
レスポンスの流れ
タスクのステータス、終了状態、結果レスポンスの例。
{
"id": "task_xxx",
"task_id": "task_xxx",
"object": "video",
"model": "Grok Imagine Video",
"status": "queued"
}待機中
queued · submitted · in_progress · processing
成功
completed · succeeded · success
失敗
failed · failure · cancelled · canceled
エラーと本番運用
再試行のルール、冪等性、最低限の本番チェックリスト。
エラーと本番運用
再試行のルール、冪等性、最低限の本番チェックリスト。
400 / 422リクエストのフィールドや対応していないオプションを修正してください。そのまま再試行しないでください。
401API キーが指定されていて有効か、Bearer トークンとして送信されているかを確認してください。
402アカウント残高が不足しています。
409Idempotency-Key が処理中か、別のボディで再利用されました。
429再試行する前に、Retry-After に従ってバックオフしてください。
5xx指数バックオフで再試行し、元の Idempotency-Key をそのまま使ってください。
- 一般向けのモバイルアプリやブラウザアプリでは、API キーをサーバーに保管してください。
- 課金対象の非同期操作ごとに、一意の Idempotency-Key を設定してください。
- 再起動後にポーリングを再開できるよう、task_id を保存してください。
- すべての HTTP リクエストにタイムアウトを設定し、サポートへの報告にはリクエスト ID を含めてください。
- 料金や対応オプションをハードコードせず、リアルタイムのモデルメタデータを読み取ってください。
料金とティア
公式価格より 12% お得リクエスト単価
$0.044/秒
$0.05
ティア別料金
基本料金 $0.044/秒
ティア別料金 — 最終的な料金はリクエストで指定するオプションによって決まります。記載のないティアは基本料金で課金されます。 生成された出力の秒数で課金されます。
- 16:9×1$0.044/秒
- 1:1×1$0.044/秒
- 2:3×1$0.044/秒
- 3:2×1$0.044/秒
- 3:4×1$0.044/秒
- 4:3×1$0.044/秒
- 9:16×1$0.044/秒
- auto×1$0.044/秒
- 480p×1$0.044/秒
- 720p×1.4$0.0616/秒
- 元動画は問わず×1.6$0.0704/秒
- 1×1$0.044
- 2×2$0.088
- 3×3$0.132
- 4×4$0.176
- 5×5$0.22
- 6×6$0.264
- 7×7$0.308
- 8×8$0.352
- 9×9$0.396
- 10×10$0.44
- 11×11$0.484
- 12×12$0.528
- 13×13$0.572
- 14×14$0.616
- 15×15$0.66
ここに表示される料金がそのまま請求額です — 失敗した呼び出しは自動で返金されます。
関連モデル