/omni/media/v1/contents/generations/tasksSeedance 影片生成
Seedance 系列支持文生影片、图生影片、首帧与尾帧控制、参考图、参考影片与参考音讯,以及可选的生成音讯。所有 Seedance 模型共用影片生成的端点与 content[] 格式:建立任务、轮询到终态、下载 content.video_url。不确定用哪个,就用 seedance-2-0。
选模型#
用建立任务时的同一把密钥呼叫 GET https://api.atptoken.ai/v1/project/models,这是项目能用的完整清单(/v1/models 只列 chat 模型)。清单上没有不代表不能用;没有权限时,建立任务会回 403,不收费。
模型 ID 是 seedance-2-0-mini。seedance-2-mini 不是它的别名,送出会回 400 InvalidParameter。
支持的生成模式#
首帧/尾帧模式和参考素材模式是两种不同的操作:首帧会成为影片的第一个画面;参考图只提供外观、风格或角色,不会被当成第一个画面。
各模型支持的素材组合#
素材数量上限#
媒体 roles#
参数#
有首帧时,画面比例怎么决定#
seedance-2-0系列(含 fast、mini):输出比例由ratio决定,不是由首帧决定。ratio默认16:9,所以直式首帧不指定比例,会得到横式影片(480p 时 864×496),画面被重新构图。送ratio: "adaptive",输出就跟著首帧(直式首帧 → 496×864)。seedance-2-5: 带首尾帧时不要送ratio。没有首尾帧时可以送,例如ratio: "16:9"。
/v1/files 的文件 ID(an_…)不是素材网址,放进来会回 400。
在 seedance-2-0、seedance-2-0-mini 上登记素材时,name 超过 64 个字元,登记照样回 200,但 assets/get 会回失败(InvalidParameter.Name),建任务得到 ATP_ASSET_FAILED。这不是偶发,缩短 name 即可,不必改用公开网址。
范例#
以下范例都送到同一个端点:
curl https://api.atptoken.ai/omni/media/v1/contents/generations/tasks \
-H "Authorization: Bearer $ATP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: my-video-job-001" \
--data-binary @request.json
# → 202 { "id": "cgt_..." }把下列任一段存成 request.json。网络中断后重送同一个请求时,沿用同一个 Idempotency-Key;新的作品换新的 key。
文生影片#
{
"model": "seedance-2-0",
"content": [
{ "type": "text", "text": "A cinematic tracking shot of Taipei at night, neon reflections, smooth camera motion" }
],
"resolution": "480p",
"ratio": "16:9",
"duration": 4,
"generate_audio": false
}图生影片#
{
"model": "seedance-2-0",
"content": [
{ "type": "text", "text": "Animate this product shot with a slow premium studio push-in." },
{ "type": "image_url", "image_url": { "url": "https://example.com/product.jpg" }, "role": "first_frame" }
],
"resolution": "720p",
"ratio": "adaptive",
"duration": 4,
"generate_audio": false,
"return_last_frame": true
}"ratio": "adaptive" 不要拿掉,原因见上方「画面比例怎么决定」。
首帧与尾帧(Seedance 2.5)#
{
"model": "seedance-2-5",
"content": [
{ "type": "text", "text": "Create a smooth transition from morning to night with consistent camera framing." },
{ "type": "image_url", "image_url": { "url": "https://example.com/morning.jpg" }, "role": "first_frame" },
{ "type": "image_url", "image_url": { "url": "https://example.com/night.jpg" }, "role": "last_frame" }
],
"resolution": "720p",
"duration": 6,
"generate_audio": false,
"output_format": "mp4"
}这里刻意不送 ratio,原因见上方「画面比例怎么决定」。
参考图加参考影片#
{
"model": "seedance-2-0",
"content": [
{ "type": "text", "text": "The character from the reference image dances with the motion of the reference video." },
{ "type": "image_url", "image_url": { "url": "https://example.com/character.jpg" }, "role": "reference_image" },
{ "type": "video_url", "video_url": { "url": "https://example.com/motion.mp4" }, "role": "reference_video" }
],
"resolution": "480p",
"ratio": "16:9",
"duration": 4,
"generate_audio": false
}取得结果#
curl https://api.atptoken.ai/omni/media/v1/contents/generations/tasks/cgt_xxx \
-H "Authorization: Bearer $ATP_API_KEY"持续轮询,直到 status 变成 succeeded、failed、cancelled 或 expired。成功时从 content.video_url 下载影片。这个网址 24 小时后失效:状态仍是 succeeded,但 video_url 变成 null、另有 expired: true。请在期限内存到自己的储存空间。
计费#
影片按 video tokens 计费,任务进入终态后依实际用量结算:
video_tokens = (in_dur + out_dur) × W × H × fps ÷ 1024in_dur 是输入影片秒数、out_dur 是输出秒数。模型自己回报用量时,以回报的为准。任务失败不计费。最便宜的端到端 smoke test 可用 480p、duration: 4、generate_audio: false。