Seedance 2.0 API 文档
将 Seedance 2.0 视频生成 API 集成到您的应用程序的完整指南。
API v1.0 Base URL: https://seedanceapi.org/v1
快速开始
bash
| 1 | curl -X POST 'https://seedanceapi.org/v1/generate' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' \ |
| 3 | -H 'Content-Type: application/json' \ |
| 4 | -d '{ |
| 5 | "prompt": "A cinematic shot of mountains at sunrise with flowing clouds", |
| 6 | "aspect_ratio": "16:9", |
| 7 | "resolution": "720p", |
| 8 | "duration": "8" |
| 9 | }' |
身份认证
所有 API 请求都需要在 Authorization 头中使用 Bearer 令牌进行身份验证。
重要提示: 您可以在控制面板的 API Keys 页面获取您的 API 密钥。 → 获取 API 密钥
http
| 1 | Authorization: Bearer YOUR_API_KEY |
定价
480p
480p 分辨率
快速生成,适合预览和草稿
| 时长 | 无音频 | 含音频 |
|---|---|---|
| 4s | 8 credits ($0.04) | 14 credits ($0.07) |
| 8s | 14 credits ($0.07) | 28 credits ($0.14) |
| 12s | 19 credits ($0.095) | 38 credits ($0.19) |
720p
720p 分辨率
高质量输出,推荐用于正式项目
| 时长 | 无音频 | 含音频 |
|---|---|---|
| 4s | 14 credits ($0.07) | 28 credits ($0.14) |
| 8s | 28 credits ($0.14) | 56 credits ($0.28) |
| 12s | 42 credits ($0.21) | 84 credits ($0.42) |
API 端点
POST
/v1/generate使用 Seedance 2.0 模型创建新的视频生成任务。支持文生视频和图生视频模式。
请求体
Body ParametersJSON
prompt:string
视频描述文本(最多 2000 字符)
aspect_ratio:optional string
输出宽高比。支持:1:1, 16:9, 9:16, 4:3, 3:4, 21:9, 9:21 Defaults to 1:1.
resolution:optional string
视频分辨率:480p 或 720p Defaults to 720p.
duration:optional string
视频时长(秒):4、8 或 12 Defaults to 8.
generate_audio:optional boolean
启用 AI 音频生成 Defaults to false.
fixed_lens:optional boolean
锁定镜头以减少运动模糊 Defaults to false.
image_urls:optional string[]
参考图片 URL 数组,用于图生视频(最多 1 张)
callback_url:optional string
异步状态通知的 Webhook URL。必须是公网可访问地址(不支持 localhost)。
文生视频
json
| 1 | { |
| 2 | "prompt": "A majestic eagle soaring through golden sunset clouds over ocean waves", |
| 3 | "aspect_ratio": "16:9", |
| 4 | "resolution": "720p", |
| 5 | "duration": "8" |
| 6 | } |
图生视频
json
| 1 | { |
| 2 | "prompt": "The character slowly turns and smiles at the camera", |
| 3 | "image_urls": [ |
| 4 | "https://example.com/my-image.jpg" |
| 5 | ], |
| 6 | "aspect_ratio": "16:9", |
| 7 | "resolution": "720p", |
| 8 | "duration": "4" |
| 9 | } |
含音频生成
json
| 1 | { |
| 2 | "prompt": "A peaceful river flowing through a forest with birds singing", |
| 3 | "aspect_ratio": "16:9", |
| 4 | "resolution": "720p", |
| 5 | "duration": "8", |
| 6 | "generate_audio": true, |
| 7 | "fixed_lens": true |
| 8 | } |
响应
Task created successfully
| 1 | { |
| 2 | "code": 200, |
| 3 | "message": "success", |
| 4 | "data": { |
| 5 | "task_id": "seed15abc123def456pro", |
| 6 | "status": "IN_PROGRESS" |
| 7 | } |
| 8 | } |
GET
/v1/status检查视频生成任务的状态,并在完成后获取结果。
查询参数
Body ParametersJSON
task_id:string
生成接口返回的唯一任务 ID
请求示例
bash
| 1 | curl -X GET 'https://seedanceapi.org/v1/status?task_id=seed15abc123def456pro' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' |
💡 Tip: 状态 API 中的 response 字段是一个视频 URL 数组,您可以直接通过 data.response[0] 获取视频 URL。
javascript
| 1 | // Extract video URL from response |
| 2 | const videoUrl = data.response[0]; |
响应
| 1 | { |
| 2 | "code": 200, |
| 3 | "message": "success", |
| 4 | "data": { |
| 5 | "task_id": "seed15abc123def456pro", |
| 6 | "status": "SUCCESS", |
| 7 | "consumed_credits": 28, |
| 8 | "created_at": "2026-02-07T10:30:00Z", |
| 9 | "request": { |
| 10 | "prompt": "A majestic eagle soaring through golden sunset clouds", |
| 11 | "aspect_ratio": "16:9", |
| 12 | "resolution": "720p", |
| 13 | "duration": "8" |
| 14 | }, |
| 15 | "response": [ |
| 16 | "https://cdn.example.com/videos/seed15abc123def456pro.mp4" |
| 17 | ], |
| 18 | "error_message": null |
| 19 | } |
| 20 | } |
API 测试工具
直接在浏览器中测试 API。将 YOUR_API_KEY 替换为您的实际 API 密钥。
API 测试沙盒POST
错误代码
| Status | Code | Description |
|---|---|---|
| 400 错误请求 | INVALID_PROMPT | 提示词无效或为空 |
| 400 错误请求 | INVALID_ASPECT_RATIO | 不支持的宽高比 |
| 400 错误请求 | INVALID_RESOLUTION | 分辨率必须是 480p 或 720p |
| 400 错误请求 | INVALID_DURATION | 时长必须是 4、8 或 12 秒 |
| 400 错误请求 | TOO_MANY_IMAGES | image_urls 数组最多允许 1 张图片 |
| 401 未授权 | INVALID_API_KEY | API 密钥缺失或无效 |
| 402 | INSUFFICIENT_CREDITS | 积分不足 |
| 404 未找到 | TASK_NOT_FOUND | 任务 ID 未找到或不属于您的账户 |
| 500 服务器内部错误 | INTERNAL_ERROR | 服务器错误,请稍后重试 |