Seedance 2.0 API API 文档
一切你需要的,将 Seedance 2.0 视频生成集成到你的应用中。
接口地址
https://api.defapi.org认证方式
所有 API 请求需要在请求头中携带 API Key。
Authorization: Bearer <your-api-key>示例: Bearer dk-1234567890abcdef
POST
/api/video/seedance/gen使用 Seedance AI 生成视频,返回 task_id 用于轮询。
请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 否 | 使用的 AI 模型,默认:seedance-2.0 |
| content | array | 是 | 文本/图片数组,最多 9 张图片,用 @image1、@image2… 引用图片 |
| duration | integer | 否 | 视频时长(秒),可选:5、10、15,默认:5 |
| ratio | string | 否 | 宽高比,可选:16:9、9:16、1:1、4:3、3:4、21:9,默认:16:9 |
| callback_url | string | 否 | 任务完成后接收 POST 回调的 Webhook 地址 |
示例
文本生成视频
POST https://api.defapi.org/api/video/seedance/gen
Authorization: Bearer dk-1234567890abcdef
Content-Type: application/json
{
"model": "seedance-2.0",
"content": [
{ "type": "text", "text": "A beautiful beach scene with waves gently lapping at the shore" }
]
}图片生成视频(用 @image1、@image2 引用图片)
{
"model": "seedance-2.0",
"content": [
{ "type": "text", "text": "The cat in @image1 walks through a garden, then meets the dog in @image2" },
{ "type": "image_url", "image_url": { "url": "https://example.com/cat.png" } },
{ "type": "image_url", "image_url": { "url": "https://example.com/dog.png" } }
],
"duration": 5,
"callback_url": "https://example.com/webhook/video-callback"
}响应
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta12345678-1234-1234-1234-123456789abc"
}
}GET
/api/task/query查询视频生成任务的状态和结果。
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| task_id | string | 是 | 生成接口返回的 Task ID |
示例
GET https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071 Authorization: Bearer dk-1234567890abcdef
响应
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta823dfb-eaac-44fd-aec2-3e2c7ba8e071",
"status": "success",
"result": { "video": "https://example.com/generated-video.mp4" },
"consumed": "0.500000",
"status_reason": { "message": null },
"created_at": "2025-08-03T10:22:20.010Z"
}
}错误码
| HTTP 状态码 | code 字段 | 含义 |
|---|---|---|
| 200 | 0 | 成功 |
| 400 | 1 | 请求参数错误 |
| 401 | 1 | 未授权 — API Key 缺失或无效 |
| 404 | 1 | 任务不存在 |
| 500 | 1 | 服务器内部错误 |