跳轉到主要內容

概覽

這些介面面向已經使用火山風格 Seedance 任務結構的團隊。鑑權使用 TokenLab Bearer API Key。返回的任務 ID 以 cgt- 開頭;請輪詢狀態介面,直到 status 變為 succeededfailedcancelledexpired 也可以呼叫 Action 分發入口,支援 CreateContentsGenerationsTasksGetContentsGenerationsTaskListContentsGenerationsTasksDeleteContentsGenerationsTasksActionVersion 不區分大小寫。Version 可省略;如傳入則必須為 2024-01-01 這一版不接受 callback_url。請透過輪詢查詢任務狀態,避免接入方誤以為回調已經生效。 另見 Seedance 2.0 影片模型影片生成.

內容規則

  • type=text 用於提示詞文字。
  • type=image_url 不傳 role 時按首幀處理,也可以明確傳 role=first_frame
  • role=last_frame 必須和首幀一起使用。
  • role=reference_imagereference_videoreference_audio 用於參考素材。
  • 同一個請求中不要混用首尾幀輸入和參考素材。

參數說明

  • ratio 支援 16:94:31:13:49:1621:9adaptive
  • generate_audio 預設為 true;需要靜音影片時傳 false
  • service_tier=default 可用。Seedance 2.0 相容任務會拒絕 service_tier=flexframescamera_fixed=true
  • 當所選模型支援時,tools 可以傳入類似 { "type": "web_search" } 的物件。格式錯誤的 tool 項會被拒絕,而不是靜默忽略。

範例

curl https://api.tokenlab.sh/api/v3/contents/generations/tasks \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "A cinematic forest at sunset"},
      {"type": "image_url", "role": "reference_image", "image_url": {"url": "https://example.com/ref.png"}}
    ],
    "ratio": "16:9",
    "duration": 5,
    "resolution": "720p",
    "generate_audio": true
  }'