Grok Imagine 视频 API:文生与图生
用 BetterToken API Key 接入 Grok Imagine Video 与 Grok Imagine Video 1.5,按 Model ID 和操作选择字段、素材与生成方式。
你可以用文字生成 16:9 有声视频,也可以用一张首帧图片生成视频。grok-imagine-video-1.5 支持文生与图生,最高 1080p;grok-imagine-video 支持文生,最高 720p。
先准备 BetterToken API Key。Base URL 为 https://bettertoken.ai/v1,认证使用 Authorization: Bearer YOUR_API_KEY。原样复制 Model ID,大小写必须一致。
下方每份 request.json 都使用同一流程:先报价,再确认创建、轮询与下载。报价不启动生成;创建会提交付费任务。当前费用见模型广场。
型号与操作
下表按操作列出可选值;字段默认值、素材数量和组合限制见对应小节。素材大小按 1 MB = 1048576 字节换算。
| Model ID | 操作 | 时长(秒) | 输出档位 | 比例 | 音频 | 素材角色 |
|---|---|---|---|---|---|---|
grok-imagine-video | text_to_video | 1–15,步长 1 | 480p、720p | 16:9 | on | 无 |
grok-imagine-video-1.5 | image_to_video | 1–15,步长 1 | 480p、720p、1080p | 不传 | on | first_frame |
grok-imagine-video-1.5 | text_to_video | 1–15,步长 1 | 480p、720p、1080p | 16:9 | on | 无 |
两款型号的成片都带音频,音频固定为 on。图生不接受 output.aspect_ratio,成片画幅跟随首帧图片。
示例素材
图生示例使用白色桌面上的蓝色陶瓷杯。你可以保留样图试用,也可以先替换为自己有权使用且符合本页限制的公网 HTTPS 图片。样图为正方形,因此图生示例的成片也是正方形。

文生视频
grok-imagine-video
你只有文字描述,并且 720p 以内的画质已经够用时,使用本操作。
把 model 设为本小节的 Model ID,把 operation 设为 text_to_video。仅使用下表列出的生成字段。
| 字段 | 类型 | 必填 | 可选值或范围 | 默认值 |
|---|---|---|---|---|
audio.mode | string | 否 | on | on |
duration.mode | string | 否 | fixed | fixed |
duration.seconds | integer | 否 | 1–15,步长 1 秒;仅固定时长使用 | 8 |
output.aspect_ratio | string | 否 | 16:9 | 16:9 |
output.format | string | 否 | mp4 | mp4 |
output.resolution | string | 否 | 480p、720p | 480p |
prompt | string | 是 | 字符串 | 无 |
watermark | boolean | 否 | false | false |
素材要求
本操作不接收素材。
组合约束
- 使用
duration.mode="fixed"时必须有duration.seconds。显式填写fixed时请同时填写秒数。
请求示例
将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。
{ "model": "grok-imagine-video", "operation": "text_to_video", "prompt": "A blue ceramic mug on a white table. Slowly move the camera closer in soft daylight.", "duration": { "mode": "fixed", "seconds": 5 }, "output": { "resolution": "720p", "aspect_ratio": "16:9" }}常见 422 错误
| 422 错误码 | 处理方法 |
|---|---|
enum / range / step | 按本节字段表调整取值与步长。 |
unsupported_field | 删除本操作字段表中没有的字段。 |
requires | 按本节组合约束补齐秒数。 |
grok-imagine-video-1.5
你只有文字描述,并且需要 1080p 时,使用本操作。
把 model 设为本小节的 Model ID,把 operation 设为 text_to_video。仅使用下表列出的生成字段。
| 字段 | 类型 | 必填 | 可选值或范围 | 默认值 |
|---|---|---|---|---|
audio.mode | string | 否 | on | on |
duration.mode | string | 否 | fixed | fixed |
duration.seconds | integer | 否 | 1–15,步长 1 秒;仅固定时长使用 | 8 |
output.aspect_ratio | string | 否 | 16:9 | 16:9 |
output.format | string | 否 | mp4 | mp4 |
output.resolution | string | 否 | 480p、720p、1080p | 480p |
prompt | string | 是 | 字符串 | 无 |
watermark | boolean | 否 | false | false |
素材要求
本操作不接收素材。
组合约束
- 使用
duration.mode="fixed"时必须有duration.seconds。显式填写fixed时请同时填写秒数。
请求示例
将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。
{ "model": "grok-imagine-video-1.5", "operation": "text_to_video", "prompt": "A blue ceramic mug on a white table. Slowly move the camera closer in soft daylight.", "duration": { "mode": "fixed", "seconds": 5 }, "output": { "resolution": "1080p", "aspect_ratio": "16:9" }}常见 422 错误
| 422 错误码 | 处理方法 |
|---|---|
enum / range / step | 按本节字段表调整取值与步长。 |
unsupported_field | 删除本操作字段表中没有的字段。 |
requires | 按本节组合约束补齐秒数。 |
图生视频
grok-imagine-video-1.5
你希望以一张图片确定起始画面时,使用本操作。
把 model 设为本小节的 Model ID,把 operation 设为 image_to_video。仅使用下表列出的生成字段;首帧图片放在 media 数组中。
| 字段 | 类型 | 必填 | 可选值或范围 | 默认值 |
|---|---|---|---|---|
audio.mode | string | 否 | on | on |
duration.mode | string | 否 | fixed | fixed |
duration.seconds | integer | 否 | 1–15,步长 1 秒;仅固定时长使用 | 8 |
output.format | string | 否 | mp4 | mp4 |
output.resolution | string | 否 | 480p、720p、1080p | 480p |
prompt | string | 是 | 字符串 | 无 |
watermark | boolean | 否 | false | false |
素材要求
| 素材角色 | 类型与数量 | 格式 | 单文件限制 |
|---|---|---|---|
first_frame | image,1 个(必填) | jpg、jpeg、png、webp | 大小不超过 20 MB;宽 1–16384 px;高 1–16384 px |
组合约束
- 使用
duration.mode="fixed"时必须有duration.seconds。显式填写fixed时请同时填写秒数。 - 必须提供 1 张
first_frame。不要传output.aspect_ratio,成片画幅跟随首帧图片。
图生除按视频时长计费外,还按首帧图片计费。创建前请核对报价中的金额。
请求示例
将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。
{ "model": "grok-imagine-video-1.5", "operation": "image_to_video", "prompt": "Slowly move the camera closer to the blue ceramic mug. Preserve its shape and the white table.", "duration": { "mode": "fixed", "seconds": 5 }, "output": { "resolution": "720p" }, "media": [ { "id": "first", "type": "image", "role": "first_frame", "source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png" } ]}常见 422 错误
| 422 错误码 | 处理方法 |
|---|---|
enum / range / step | 按本节字段表调整取值与步长。 |
unsupported_field | 删除本操作字段表中没有的字段,例如 output.aspect_ratio。 |
requires | 按本节组合约束补齐秒数或首帧图片。 |
count / media_role | 按本节素材表只传 1 张 first_frame。 |
video_input_unsupported | 检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。 |
官方资料
调用 BetterToken 时,使用本页字段与实时模型目录中的对应操作。

