/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。