创建视频生成任务(老)
说明
grok-imagine
适用场景:
- 文生视频
- 单图生视频
选择规则:
- 只有
prompt-> 文生视频 prompt + image-> 图生视频
Endpoint
POST /v1/video/generations
Query 参数
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization | string | No | Bearer {your_token} |
请求体参数
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
model | string | Yes | 公共模型名 | |
prompt | string | Yes | 主提示词 | 结构上不是绝对必填,但实际强烈建议传 |
image | string | Yes | 单张源图 URL | 图生视频 |
duration | string | Yes | 输出时长,单位秒 | 允许值:6、10 |
size | string | Yes | 输出分辨率 | 允许值:480p、720p |
aspect_ratio | string | Yes | 输出比例 | 允许值:16:9、1:1、9:16 |
请求示例
文生视频
{
"model": "grok-imagine",
"prompt": "电影感手持镜头,一名记者站在暴雪中的时代广场,路人撑伞快速走过,雪花不断打在镜头前,皮肤纹理真实,整体色调克制。",
"size": "720p",
"aspect_ratio": "16:9",
"duration": 6
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine",
"prompt": "电影感手持镜头,一名记者站在暴雪中的时代广场,路人撑伞快速走过,雪花不断打在镜头前,皮肤纹理真实,整体色调克制。",
"size": "720p",
"aspect_ratio": "16:9",
"duration": 6
}'
单图生视频
{
"model": "grok-imagine",
"prompt": "人物缓慢转头看向镜头,头发随风轻微摆动,电影级布光,镜头有细微推进。",
"image": "https://example.com/portrait.png",
"size": "480p",
"aspect_ratio": "9:16",
"duration": 10
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine",
"prompt": "人物缓慢转头看向镜头,头发随风轻微摆动,电影级布光,镜头有细微推进。",
"image": "https://example.com/portrait.png",
"size": "480p",
"aspect_ratio": "9:16",
"duration": 10
}'
响应字段
| Field | Type | Required | Title | Description |
|---|
响应示例
示例 1
{}