Seedance 2.0
通过 BeansAI 提交 Seedance 异步视频生成任务,支持文本、图片、视频和音频参考素材。
概览
302.ai 的 Seedance 文档使用火山任务接口:POST /volcengine/api/v3/contents/generations/tasks 提交任务,GET /volcengine/api/v3/contents/generations/tasks/:id 查询任务。
BeansAI 对外提供兼容入口 POST /videos 和 GET /videos/:task_id。relay 会把 Volcengine 节点路由到 302 任务接口, 并包装 task id,确保轮询时回到同一个节点。
Supported parameters
| Parameter | Purpose |
|---|---|
| model | Seedance model id, for example doubao-seedance-2-0-260128. |
| content[] | Required multimodal input array. Supported item types: text, image_url, video_url, audio_url. |
| ratio | Output aspect ratio such as 16:9, 9:16, 1:1, 4:3, 3:4, or 21:9. |
| duration | Video duration, commonly 5 or 10 seconds. |
| generate_audio | Boolean flag for generated audio. |
| watermark | Boolean flag for watermark output. |
Submit a task
curl
curl https://api.beansai.dev/v1/videos \
-H "Authorization: Bearer sk-beans-..." \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "A glossy green coffee bean mascot walks across a clean studio floor, cinematic product lighting"
}
],
"ratio": "16:9",
"duration": "5",
"generate_audio": false,
"watermark": false
}'Poll task status
保存返回的 id 或 task_id,然后持续轮询,直到状态完成并返回视频 URL。
curl
curl https://api.beansai.dev/v1/videos/beansvid_... \
-H "Authorization: Bearer sk-beans-..."Reference media
参考图片、视频或音频都放在 content[] 里。请使用上游服务可以访问的公网 HTTPS URL。
curl
curl https://api.beansai.dev/v1/videos \
-H "Authorization: Bearer sk-beans-..." \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-260128",
"content": [
{ "type": "text", "text": "Use the reference image as the main character and make a short product reveal video" },
{ "type": "image_url", "image_url": { "url": "https://example.com/reference.png" } },
{ "type": "audio_url", "audio_url": { "url": "https://example.com/music.mp3" } }
],
"ratio": "9:16",
"duration": "10",
"generate_audio": true,
"watermark": false
}'Upload image references
如果图片在本地,先上传到 BeansAI。BeansAI 会把它存到私有 R2,并返回一个短期有效的 HTTPS URL,Seedance 可以直接拉取。
控制台 Playground 在视频参考图里选择本地图片时,会自动完成这一步。
upload-reference.sh
curl https://api.beansai.dev/v1/uploads/playground-image \
-H "Authorization: Bearer sk-beans-..." \
-F "file=@./reference.png"generate-with-uploaded-reference.sh
curl https://api.beansai.dev/v1/videos \
-H "Authorization: Bearer sk-beans-..." \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-260128",
"content": [
{ "type": "text", "text": "Animate this product image into a smooth cinematic reveal" },
{ "type": "image_url", "image_url": { "url": "https://<signed-r2-url-from-upload>" } }
],
"ratio": "16:9",
"duration": "5",
"generate_audio": false,
"watermark": false
}'Simple prompt shortcut
BeansAI 也支持在 POST /videos 里直接传 prompt。对于 Volcengine 节点,relay 会自动转换为 content[] 再转发。
curl
curl https://api.beansai.dev/v1/videos \
-H "Authorization: Bearer sk-beans-..." \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-260128",
"prompt": "A quiet macro shot of green coffee beans forming the BeansAI logo",
"ratio": "1:1",
"duration": "5"
}'使用技巧
- 可以先用控制台 Playground 测试提示词、比例、时长、音频和水印设置。
- 视频生成是异步任务;如果要稍后继续查询,请保存任务 id。
- 参考素材 URL 应稳定可访问,不能依赖浏览器 Cookie。