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 用于轮询。

请求体

参数类型必填说明
modelstring使用的 AI 模型,默认:seedance-2.0
contentarray文本/图片数组,最多 9 张图片,用 @image1、@image2… 引用图片
durationinteger视频时长(秒),可选:5、10、15,默认:5
ratiostring宽高比,可选:16:9、9:16、1:1、4:3、3:4、21:9,默认:16:9
callback_urlstring任务完成后接收 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_idstring生成接口返回的 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 字段含义
2000成功
4001请求参数错误
4011未授权 — API Key 缺失或无效
4041任务不存在
5001服务器内部错误