API 文档
完整的 Seedance 2.0 API 参考文档,帮助您快速集成视频生成功能。
快速开始
开始使用 Seedance 2.0 API 只需三个简单步骤:获取 API 密钥、发送请求、获取视频。
1
获取 API 密钥
注册账号获取密钥
2
发送请求
调用 API 生成视频
3
获取视频
下载生成的视频
认证
所有 API 请求都需要在 HTTP Header 中包含您的 API 密钥:
Authorization: Bearer YOUR_API_KEY请妥善保管您的 API 密钥,不要在客户端代码中暴露。
API 端点
POST
/v1/videos/text-to-video文生视频
根据文本提示生成视频
POST
/v1/videos/image-to-video图生视频
根据图片生成视频
GET
/v1/videos/{task_id}查询状态
查询视频生成任务状态
代码示例
curl
curl -X POST https://api.seeddanceapi.com/v1/videos/text-to-video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic shot of a futuristic city at sunset",
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5
}'python
import requests
response = requests.post(
"https://api.seeddanceapi.com/v1/videos/text-to-video",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"prompt": "A cinematic shot of a futuristic city at sunset",
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5
}
)
data = response.json()
print(f"Task ID: {data['task_id']}")node
const axios = require('axios');
const response = await axios.post(
'https://api.seeddanceapi.com/v1/videos/text-to-video',
{
prompt: 'A cinematic shot of a futuristic city at sunset',
resolution: '1080p',
aspect_ratio: '16:9',
duration: 5
},
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log('Task ID:', response.data.task_id);请求参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| prompt | string | 是 | 文本提示词,描述您想要生成的视频内容 |
| image_url | string | 条件 | 图片 URL(图生视频时必填) |
| resolution | string | 否 | 视频分辨率:480p、720p、1080p |
| aspect_ratio | string | 否 | 宽高比:16:9、9:16、4:3、3:4、21:9、1:1 |
| duration | integer | 否 | 视频时长(秒),最大 10 秒 |
| seed | integer | 否 | 随机种子,用于复现结果 |
错误处理
API 使用标准的 HTTP 状态码和 JSON 错误响应:
200成功400请求参数错误401未授权,API 密钥无效429请求过于频繁500服务器内部错误