Skip to main content
POST
使用此端点可从文本、源图像或参考输入启动 Grok 视频任务。它会立即返回 request_id,因此应将其视为异步工作流的第一步。 始终显式发送 model: grok-imagine-video-1.5。本文档所述的 1.5 请求形式需要 modelprompt

选择输入模式

对于数据 URI,请使用 data:image/png;base64,<BASE64_IMAGE_DATA>。每个 reference_images 项目都使用相同的 url 字段。参考音频项目使用预设的 voice_id,例如 eve。在 Prompt 中,可使用 <IMAGE_0><AUDIO_0> 等标签来标识相应的参考。

先从小型请求开始

  • 使用 model: grok-imagine-video-1.5
  • 对于首次请求,将 duration 保持为 1,并将 resolution 保持为 480p
  • 明确指定 prompt,使场景和动作清晰
  • 在组合参考图像和语音之前,每次只添加一种输入模式

时长和分辨率

生成的视频包含音轨。当应用程序依赖于特定的输出规格时,请显式设置 durationresolutionaspect_ratio

任务流程

1

创建任务

发送模型、Prompt 和所有输入,然后保存返回的 request_id
2

轮询完成状态

调用 获取 xAI 视频结果 直到顶层 status 变为 donefailedexpired。在准备任务元数据期间,初始响应可能仅包含回显的 request_id
3

持久化输出

如果在临时交付窗口结束后仍需要,请将最终的 video.url 复制到自己的存储中。

授权

Authorization
string
header
必填

Use your CometAPI API key as the bearer value.

请求体

application/json
model
enum<string>
必填

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"

prompt
string
必填

A description of the scene, motion, and audio. Reference-to-video prompts can identify inputs with tags such as <IMAGE_0> and <AUDIO_0>.

Minimum string length: 1
示例:

"A paper boat glides across a quiet pond at sunrise."

duration
integer
默认值:8

The output duration in seconds. Use an integer from 1 through 15.

必填范围: 1 <= x <= 15
aspect_ratio
enum<string>

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

resolution
enum<string>
默认值:480p

The output resolution. Reference-to-video requests support 480p and 720p; text-to-video and image-to-video also support 1080p.

可用选项:
480p,
720p,
1080p
image
object

The source image for image-to-video. Do not combine this field with reference_images or reference_audios.

reference_images
object[]

Visual references for reference-to-video. Each item accepts a public image URL or image data URI. Do not combine this field with image.

Required array length: 1 - 7 elements
reference_audios
object[]

Preset voice references for reference-to-video. Do not combine this field with image.

Required array length: 1 - 3 elements

响应

200 - application/json

Request accepted.

request_id
string
必填

The deferred request ID used to poll GET /grok/v1/videos/{request_id}.

最后修改于 2026年8月21日