Video ModelsSeedance
Seedance 2.0 图生视频
获取 API Keyseedance-2.0-image-to-video
Seedance 2.0 图生视频 API 文档
使用
seedance-2.0-image-to-video模型,从图片生成视频内容
Overview
本文档说明如何使用 seedance-2.0-image-to-video 模型进行图生视频。
集成流程分为两步:
- 创建生成任务
- 查询任务状态和结果
Authentication
所有 API 请求都需要在请求头中携带 Bearer Token:
Authorization: Bearer YOUR_API_KEY获取 API Key:
- 打开 API Keys 页面
- 点击
Create API Key - 在请求头中加入:
Authorization: Bearer YOUR_API_KEY
1. 创建生成任务
API Information
- URL:
POST https://aigptimage.com/api/v1/jobs/createTask - Content-Type:
application/json
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 对外模型 ID,必须精确传入 seedance-2.0-image-to-video |
input | object | Yes | 输入参数对象 |
Model Parameter
model 参数用于指定对外公开的图生视频模型。
| Property | Value | Description |
|---|---|---|
| Format | seedance-2.0-image-to-video | 精确的对外模型标识 |
| Type | string | 必须传字符串 |
| Required | Yes | 所有创建任务请求都必须提供 |
Note:
model的值必须完全匹配,并且必须使用本页展示的公开模型 ID。
input Object Parameters
prompt
- Type:
string - Required: Yes
- Description: 描述输入图片应如何运动或扩展成视频的文本提示词
- Max Length: 20000 characters
image_urls
- Type:
string[] - Required: Yes
- Description: 源图片 URL 列表,会作为首帧参考输入
- Constraints: 至少需要一个有效图片 URL。第一张图会作为主参考首帧输入
aspect_ratio
- Type:
string - Required: No
- Description: 对外 API 接受的便捷比例字段,内部会映射为
ratio - Common Options:
16:9,9:16,1:1
ratio
- Type:
string - Required: No
- Description: 输出视频比例。如果同时传
ratio和aspect_ratio,优先使用ratio - Common Options:
16:9,9:16,1:1
resolution
- Type:
string - Required: No
- Description: 输出分辨率,同时也会影响积分消耗
- Options:
480p,720p,1080p
duration
- Type:
number - Required: No
- Description: 视频时长,单位秒
generate_audio
- Type:
boolean - Required: No
- Description: 是否为输出视频生成音频
- Default Value:
false
web_search
- Type:
boolean - Required: No
- Description: 是否在生成前启用联网搜索辅助
- Default Value:
false
nsfw_checker
- Type:
boolean - Required: No
- Description: 控制平台侧内容过滤
- Default Value:
false - Behavior: 如果传
false,平台侧内容过滤会被关闭,结果会直接返回模型原始输出
积分消耗
seedance-2.0-image-to-video 当前公开积分规则如下:
| 分辨率 | 每秒积分 |
|---|---|
480p | 20 |
720p | 40 |
1080p | 80 |
Request Example
{
"model": "seedance-2.0-image-to-video",
"input": {
"prompt": "Animate the product with a smooth orbiting camera move and a premium commercial mood",
"image_urls": ["https://cdn.example.com/input.png"],
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"nsfw_checker": false
}
}Response Example
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_xxxxxxxxxxxxx"
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
code | integer | 响应状态码,200 表示成功 |
msg | string | 响应消息 |
data.taskId | string | 用于查询任务状态的任务 ID |
2. 查询任务状态
API Information
- URL:
GET https://aigptimage.com/api/v1/jobs/recordInfo - Parameter:
taskId(URL 查询参数)
Request Example
GET https://aigptimage.com/api/v1/jobs/recordInfo?taskId=task_xxxxxxxxxxxxxResponse Example
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_xxxxxxxxxxxxx",
"model": "seedance-2.0-image-to-video",
"state": "waiting",
"param": "{\"model\":\"seedance-2.0-image-to-video\",\"input\":{\"prompt\":\"Animate the product with a smooth orbiting camera move and a premium commercial mood\",\"image_urls\":[\"https://cdn.example.com/input.png\"],\"ratio\":\"16:9\",\"resolution\":\"720p\",\"duration\":5}}",
"resultJson": null,
"failCode": null,
"failMsg": null,
"costTime": null,
"completeTime": null,
"createTime": 1757584164490
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
code | integer | 响应状态码,200 表示成功 |
msg | string | 响应消息 |
data.taskId | string | 任务 ID |
data.model | string | 对外模型 ID |
data.state | string | 任务状态:waiting、success、fail |
data.param | string | 原始创建任务参数,JSON 字符串 |
data.resultJson | string | null | 任务结果 JSON 字符串。视频任务成功时通常包含 resultUrls |
data.failCode | string | null | 任务失败时的错误码 |
data.failMsg | string | null | 任务失败时的错误信息 |
data.costTime | integer | null | 任务完成后的耗时,单位毫秒 |
data.completeTime | integer | null | 完成时间戳,单位毫秒 |
data.createTime | integer | 创建时间戳,单位毫秒 |
Success Result Structure
图生视频任务成功时,resultJson 通常结构如下:
{
"resultUrls": ["https://your-cdn.example.com/result-1.mp4"]
}Usage Flow
- 先准备公开可访问且稳定可用的源图片 URL
- 调用
POST /api/v1/jobs/createTask - 从响应中提取
taskId - 轮询
GET /api/v1/jobs/recordInfo?taskId=... - 成功后从
resultJson中读取输出视频 URL
Notes
- API 调用与网页端共用同一套积分余额和计费规则
- 第一张源图片会作为主参考首帧输入
resolution、duration和音频设置会影响积分消耗
Error Codes
| Status Code | Description |
|---|---|
200 | 请求成功 |
400 | 请求参数无效 |
401 | 鉴权失败或 API key 无效 |
402 | 积分不足 |
404 | 任务或资源不存在 |
409 | 活跃任务数超限或请求冲突 |
422 | 参数校验失败 |
429 | 请求超过限流 |
500 | 服务内部错误 |