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>

时长和分辨率

任务流程

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.