Skip to main content
POST
使用此端點可從一張來源圖片與一個 prompt 啟動 Grok 圖生影片任務。它會立即回傳 request_id,因此請將其視為非同步工作流程的第一步。

從小型請求開始

  • 使用 model: grok-imagine-video-1.5
  • image.url 設為公開可存取的 JPEG、PNG 或 WebP URL
  • 對於第一次請求,請將 duration 保持為 1,並將 resolution 保持為 720p
  • prompt 保持明確,讓動畫方向清楚
  • 如果你傳送 base64,請將文件與 OpenAPI 範例格式保留為 data:image/png;base64,<BASE64_IMAGE_DATA>

Duration 和 resolution

任務流程

1

建立任務

傳送 prompt 與來源圖片,然後儲存回傳的 request_id
2

輪詢完成狀態

呼叫 取得 xAI 影片結果,直到巢狀 provider 狀態變為 done
3

保存輸出

如果你需要在 provider 的暫時交付視窗之後仍能使用最終輸出,請將最終的 video.url 複製到你自己的儲存空間中。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json
prompt
string
必填

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."

aspect_ratio
enum<string>

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
duration
integer
預設值:8

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.

image
object

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>.

model
string
預設值:grok-imagine-video-1.5

xAI video model id. The default example uses Grok Imagine 1.5 for image-to-video.

範例:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
預設值:720p

Output resolution. Use 720p for a small image-to-video test, or 1080p when you need a higher resolution tier.

可用選項:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

回應

200 - application/json

Request accepted.

request_id
string
必填

Deferred request id used for polling.