视频生成
本平台统一视频生成与人像素材 API 规范
视频生成和人像素材上传均采用异步任务模式。所有请求使用本平台令牌鉴权:
Authorization: Bearer sk-你的令牌创建视频任务
POST /v1/videos
Content-Type: application/json请求字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 本平台视频模型值。 |
prompt | string | 视模式而定 | 视频提示词;纯参考素材模式下可选。 |
mode | string | 否 | 生成模式,默认 auto。 |
imageUrl | string | 否 | 单张参考图 URL 或人像素材引用。 |
imageUrls | string[] | 否 | 多张参考图 URL 或人像素材引用。 |
firstFrameUrl | string | 否 | 首帧图片 URL;使用首尾帧模式时必填。 |
lastFrameUrl | string | 否 | 尾帧图片 URL;必须与 firstFrameUrl 一起传入。 |
videoUrls | string[] | 否 | 参考视频 URL 列表。 |
audioUrls | string[] | 否 | 参考音频 URL 列表。 |
aspectRatio | string | 否 | 画面比例,如 16:9、9:16、1:1。 |
seconds | string 或 number | 否 | 视频时长(秒);可用值以所选模型为准。 |
resolution | string | 否 | 输出清晰度,如 720p、1080p。 |
generate_audio | boolean | 否 | 是否生成音频。 |
negative_prompt | string | 否 | 反向提示词。 |
seed | number | 否 | 随机种子。 |
字段支持范围
不同模型支持的模式、参考素材类型、时长和分辨率可能不同。请求中只需使用本页列出的统一字段。
mode 取值
| 值 | 说明 |
|---|---|
auto | 根据请求中提供的文本和参考素材生成视频。 |
text-to-video | 文生视频。 |
image-to-video | 单图图生视频。 |
reference-to-video | 使用一项或多项参考图、参考视频或参考音频生成视频。 |
start-end-to-video | 使用首帧和尾帧生成视频。 |
请求示例
curl https://geekapi.net/v1/videos \
-H "Authorization: Bearer sk-你的令牌" \
-H "Content-Type: application/json" \
-d '{
"model": "video-model-id",
"prompt": "黄昏海边,一架纸飞机从镜头前飞过",
"aspectRatio": "16:9",
"seconds": 5,
"resolution": "720p"
}'创建成功后返回视频任务对象:
{
"id": "task_xxx",
"object": "video",
"model": "video-model-id",
"status": "queued",
"progress": 0,
"created_at": 1782658000
}查询视频任务
GET /v1/videos/{task_id}任务状态包括 queued、in_progress、completed 和 failed。任务完成后,响应中会包含视频结果:
{
"id": "task_xxx",
"object": "video",
"model": "video-model-id",
"status": "completed",
"progress": 100,
"created_at": 1782658000,
"completed_at": 1782658060,
"metadata": {
"videos": [
{
"url": "https://example.com/result.mp4"
}
]
}
}获取视频内容
任务完成后可通过以下接口读取视频内容:
GET /v1/videos/{task_id}/content人像库接口
平台提供两套独立的人像库接口:
| 人像库 | 适用模型 | 提交接口 | 查询任务接口 |
|---|---|---|---|
| ZKJ 人像库 | zkj-seedance2、zkj-seedance2-fast、zkj-seedance2-mini | POST /v1/materials/review | GET /v1/materials/review/{task_id} |
| Geek人像库 | seedance-2.0 | POST /v1/materials/assets | GET /v1/materials/assets/tasks/{task_id} |
人像素材不可混用
两套接口返回的 asset_id 分别属于各自的人像库。创建视频任务时,请使用支持对应人像库的视频模型。
上传至 ZKJ 人像库
提交一项素材至 ZKJ 人像库:
POST /v1/materials/review
Content-Type: application/json请求字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 是 | 平台可访问的 HTTP 或 HTTPS 素材地址。 |
name | string | 是 | 素材名称。 |
type | string | 是 | 素材类型:image、video 或 audio。 |
上传人像时,type 使用 image:
curl https://geekapi.net/v1/materials/review \
-H "Authorization: Bearer sk-你的令牌" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/portrait.jpg",
"name": "角色 A",
"type": "image"
}'提交成功后返回任务:
{
"task_id": "task_xxx",
"status": "processing",
"cost": 2.5
}查询 ZKJ 人像库任务
GET /v1/materials/review/{task_id}任务状态包括 processing、approved、rejected 和 failed。处理通过后返回人像素材 ID:
{
"task_id": "task_xxx",
"status": "approved",
"asset_id": "asset_xxx",
"url": "https://example.com/portrait.jpg"
}状态为 rejected 或 failed 时,响应中会包含 error。
在视频任务中使用 ZKJ 人像素材
适用模型:zkj-seedance2、zkj-seedance2-fast、zkj-seedance2-mini。
人像素材状态为 approved 后,将 asset_id 按 asset://{asset_id} 格式传入 imageUrl 或 imageUrls:
{
"model": "zkj-seedance2",
"mode": "reference-to-video",
"prompt": "保持人物外观一致,生成一段自然行走的视频",
"imageUrls": ["asset://asset_xxx"],
"aspectRatio": "9:16",
"seconds": 5,
"resolution": "720p"
}上传至 Geek人像库
将一张可访问的图片加入当前账号的人像素材库:
POST /v1/materials/assets
Content-Type: application/json可选传入 Idempotency-Key 请求头。使用相同请求键和相同请求体重试时,会返回同一个任务。
请求字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 是 | 平台可访问的人像图片 URL。 |
name | string | 否 | 素材名称。 |
type | string | 否 | 素材类型;当前固定为 image。 |
图片宽高需大于 300 像素且小于 6000 像素,宽高比需大于 0.4 且小于 2.5。
curl https://geekapi.net/v1/materials/assets \
-H "Authorization: Bearer sk-你的令牌" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: portrait-upload-001" \
-d '{
"url": "https://example.com/portrait.jpg",
"name": "角色 A",
"type": "image"
}'提交成功后返回上传任务:
{
"task_id": "task_xxx",
"status": "processing",
"cost": 0.25
}查询 Geek人像库上传任务
GET /v1/materials/assets/tasks/{task_id}任务状态包括:
| 状态 | 说明 |
|---|---|
processing | 正在处理。 |
approved | 已通过,可用于视频生成。 |
rejected | 图片未通过。 |
failed | 上传失败,可查看 error。 |
处理完成后返回素材信息:
{
"task_id": "task_xxx",
"status": "approved",
"asset_id": "s2asset_xxx",
"name": "角色 A",
"type": "image",
"url": "https://example.com/portrait.jpg"
}查询 Geek人像素材
GET /v1/materials/assets/{asset_id}{
"asset_id": "s2asset_xxx",
"name": "角色 A",
"type": "image",
"status": "approved",
"url": "https://example.com/portrait.jpg",
"created_at": 1782658000
}在视频任务中使用 Geek人像素材
适用模型:seedance-2.0。
人像素材状态为 approved 后,将 asset_id 按 asset://{asset_id} 格式传入 imageUrl 或 imageUrls。该素材只能由有权限的账号使用。
{
"model": "seedance-2.0",
"mode": "reference-to-video",
"prompt": "保持人物外观一致,生成一段自然行走的视频",
"imageUrls": ["asset://s2asset_xxx"],
"aspectRatio": "9:16",
"seconds": 5,
"resolution": "720p"
}