使用 Grok 创建视频
从文本、源图像或图像和预设语音参考创建异步 Grok Imagine Video 1.5 任务。
request_id,因此应将其视为异步工作流的第一步。
始终显式发送 model: grok-imagine-video-1.5。本文档所述的 1.5 请求形式需要 model 和 prompt。
选择输入模式
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,使场景和动作清晰 - 在组合参考图像和语音之前,每次只添加一种输入模式
时长和分辨率
duration、resolution 和 aspect_ratio。
任务流程
创建任务
request_id。轮询完成状态
status 变为 done、failed 或 expired。在准备任务元数据期间,初始响应可能仅包含回显的 request_id。持久化输出
video.url 复制到自己的存储中。授权
Use your CometAPI API key as the bearer value.
请求体
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"
A description of the scene, motion, and audio. Reference-to-video prompts can identify inputs with tags such as <IMAGE_0> and <AUDIO_0>.
1"A paper boat glides across a quiet pond at sunrise."
The output duration in seconds. Use an integer from 1 through 15.
1 <= x <= 15The 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"
The output resolution. Reference-to-video requests support 480p and 720p; text-to-video and image-to-video also support 1080p.
480p, 720p, 1080p The source image for image-to-video. Do not combine this field with reference_images or reference_audios.
Visual references for reference-to-video. Each item accepts a public image URL or image data URI. Do not combine this field with image.
1 - 7 elementsPreset voice references for reference-to-video. Do not combine this field with image.
1 - 3 elements响应
Request accepted.
The deferred request ID used to poll GET /grok/v1/videos/{request_id}.