# Seedance 2.0 API ByteDance Seedance 2.0 影片生成模型的完整 API 參考文件。 ## 模型版本 此 API 支援六種模型: | 模型 | ID | 說明 | |-------|-----|-------------| | **Seedance 2.0 Text to Video** | `seedance-v2.0-text-to-video` | 高品質文字生成影片 | | **Seedance 2.0 Image to Video** | `seedance-v2.0-image-to-video` | 支援動作控制的圖片動畫生成 | | **Seedance 2.0 Reference to Video** | `seedance-v2.0-reference-to-video` | 透過參考影片引導生成影片 | | **Seedance 2.0 Fast Text to Video** | `seedance-v2.0-fast-text-to-video` | 更快速的文字生成影片 | | **Seedance 2.0 Fast Image to Video** | `seedance-v2.0-fast-image-to-video` | 更快速的圖片生成影片 | | **Seedance 2.0 Fast Reference to Video** | `seedance-v2.0-fast-reference-to-video` | 更快速的參考素材引導影片生成 | ## 快速比較 | 功能 | 標準模型 | Fast 模型 | |---------|-----------------|-------------| | 品質 | 更高品質 | 針對速度最佳化 | | 處理時間 | 3-8 分鐘 | 1-4 分鐘 | | 時長範圍 | 4-15 秒 | 4-15 秒 | | 解析度選項 | 480p, 720p, 1080p, 4k | 480p, 720p | | 參考素材 | Reference-to-Video 支援圖片、影片和音訊 | Fast Reference-to-Video 支援圖片、影片和音訊 | ### 支援的長寬比 `21:9`, `16:9`, `9:16`, `1:1`, `4:3`, `3:4` ### 解析度選項 | 解析度 | 說明 | |------------|-------------| | `480p` | 標準畫質,處理更快 | | `720p` | 高畫質,兼顧品質與速度 | | `1080p` | Full HD,適用於所有標準 Seedance 2.0 模型 | | `4k` | Ultra HD,適用於所有標準 Seedance 2.0 模型 | ## Seedance 2.0 文字生成影片 ### 端點 ``` POST /api/v1/video/task ``` ### 請求參數 #### 必填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedance-v2.0-text-to-video"` | | `prompt` | string | 影片生成提示詞 | | `duration` | integer | 影片時長以整數秒表示(4-15),間隔為 1 | | `resolution` | string | 輸出解析度:`"480p"`、`"720p"`、`"1080p"` 或 `"4k"` | | `aspect_ratio` | string | 影片長寬比:`"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"` | #### 選填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `sound` | boolean | 是否生成聲音。預設為 `true`;不影響價格 | ### 請求範例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'seedance-v2.0-text-to-video', prompt: 'A golden retriever running through a sunlit meadow', duration: 6, resolution: '720p', aspect_ratio: '16:9' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Seedance 2.0 圖片生成影片 ### 請求參數 #### 必填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedance-v2.0-image-to-video"` | | `prompt` | string | 影片生成提示詞 | | `duration` | integer | 影片時長以整數秒表示(4-15),間隔為 1 | | `resolution` | string | 輸出解析度:`"480p"`、`"720p"`、`"1080p"` 或 `"4k"` | | `aspect_ratio` | string | 影片長寬比:`"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"` | | `image_url` | string | 影片首幀 | #### 選填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `image_end_url` | string | 選填的尾幀圖片 URL | | `sound` | boolean | 是否生成聲音。預設為 `true`;不影響價格 | ### 請求範例 ```javascript { model_name: 'seedance-v2.0-image-to-video', image_url: 'https://example.com/image.jpg', image_end_url: 'https://example.com/end-frame.jpg', prompt: 'Camera slowly pulls back to reveal the full landscape', duration: 6, resolution: '720p', aspect_ratio: '16:9' } ``` ## Seedance 2.0 參考素材生成影片 ### 請求參數 #### 必填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedance-v2.0-reference-to-video"` | | `prompt` | string | 影片生成提示詞。可撰寫不含預留位置的普通提示詞,或使用 @(AT)參照功能,透過 `<<>>`、`<<>>` 和 `<<>>` 明確參照對應素材陣列中的項目 | | `duration` | integer | 影片時長以整數秒表示(4-15),間隔為 1 | | `resolution` | string | 輸出解析度:`"480p"`、`"720p"`、`"1080p"` 或 `"4k"` | | `aspect_ratio` | string | 影片長寬比:`"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"` | #### 參考素材 提交 1-9 張圖片。僅在提供至少一段參考影片時,才可省略圖片。 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `images` | string[] | 1-9 個參考圖片 URL;當 `videos` 非空時,也可使用空陣列 | | `videos` | string[] | 最多 3 個參考影片 URL;每段影片須為 2-15 秒,總時長不得超過 15 秒 | | `audios` | string[] | 最多 3 個參考音訊 URL;每段音訊須為 2-15 秒,總時長不得超過 15 秒;WAV 或 MP3,每段不超過 15 MB;需有至少一張圖片或一段影片 | #### @(AT)參照預留位置 @(AT)參照功能透過帶編號的 `<<<...>>>` 預留位置,將參考素材連結至提示詞。每種素材類型各自從 `1` 開始編號,順序與對應陣列一致: | 預留位置 | 參照值 | |-------------|------------------| | `<<>>` | `images[0]` | | `<<>>` | `images[1]` | | `<<>>` | `videos[0]` | | `<<>>` | `audios[0]` | 例如,若第一張圖片為角色參考,第二張圖片為場景參考,請在 `prompt` 中使用 `<<>>` 參照角色,使用 `<<>>` 參照場景。每個預留位置必須指向對應陣列中實際存在的項目。 #### 選填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `sound` | boolean | 是否生成同步聲音。預設為 `true` | ### 請求範例 ```javascript { model_name: 'seedance-v2.0-reference-to-video', prompt: 'Use image one for the subject, video one for the movement, and audio one for the atmosphere', duration: 8, resolution: '1080p', aspect_ratio: '16:9', sound: true, images: ['https://example.com/subject-reference.jpg'], videos: ['https://example.com/motion-reference.mp4'], audios: ['https://example.com/atmosphere-reference.mp3'] } ``` ### @(AT)參考素材生成影片請求範例 ```javascript { model_name: 'seedance-v2.0-reference-to-video', prompt: 'Place the explorer from <<>> in the environment from <<>>, following the camera movement in <<>> and speaking with the reference voice from <<>>', duration: 8, resolution: '1080p', aspect_ratio: '16:9', sound: true, images: [ 'https://example.com/explorer-reference.jpg', 'https://example.com/environment-reference.jpg' ], videos: ['https://example.com/camera-movement-reference.mp4'], audios: ['https://example.com/voice-reference.mp3'] } ``` ## Fast 版本 Fast 版本優先考量處理速度。所有 Fast 模型僅支援 `"480p"` 和 `"720p"` 輸出。Fast 文字生成影片和 Fast 圖片生成影片的其他請求結構與對應標準模型一致,Fast 參考素材生成影片的素材限制也與標準參考模型相同。 ### Fast 請求範例 ```javascript { model_name: 'seedance-v2.0-fast-reference-to-video', prompt: 'Use image one for the subject, follow the movement from video one, and use audio one for the atmosphere', duration: 8, resolution: '720p', aspect_ratio: '9:16', sound: true, images: ['https://example.com/subject-reference.jpg'], videos: ['https://example.com/motion-reference.mp4'], audios: ['https://example.com/atmosphere-reference.mp3'] } ``` ### @(AT)Fast 參考素材生成影片請求範例 ```javascript { model_name: 'seedance-v2.0-fast-reference-to-video', prompt: 'Have the dancer from <<>> perform the movement from <<>> on the stage in <<>>, using the rhythm from <<>>', duration: 8, resolution: '720p', aspect_ratio: '9:16', sound: true, images: [ 'https://example.com/dancer-reference.jpg', 'https://example.com/stage-reference.jpg' ], videos: ['https://example.com/dance-movement-reference.mp4'], audios: ['https://example.com/rhythm-reference.mp3'] } ``` ### Seedance 2.0 Fast 參考素材生成影片參數 #### 必填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedance-v2.0-fast-reference-to-video"` | | `prompt` | string | 影片生成提示詞。可撰寫不含預留位置的普通提示詞,或使用 @(AT)參照功能,透過 `<<>>`、`<<>>` 和 `<<>>` 明確參照對應素材陣列中的項目 | | `duration` | integer | 影片時長以整數秒表示(4-15),間隔為 1 | | `resolution` | string | 輸出解析度:`"480p"` 或 `"720p"` | | `aspect_ratio` | string | 影片長寬比:`"21:9"`、`"16:9"`、`"9:16"`、`"1:1"`、`"4:3"` 或 `"3:4"` | #### 參考素材 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `images` | string[] | 1-9 個參考圖片 URL;當 `videos` 非空時,也可使用空陣列 | | `videos` | string[] | 最多 3 個參考影片 URL;每段影片須為 2-15 秒,總時長不得超過 15 秒 | | `audios` | string[] | 最多 3 個參考音訊 URL;每段音訊須為 2-15 秒,總時長不得超過 15 秒;WAV 或 MP3,每段不超過 15 MB;需有至少一張圖片或一段影片 | 上述從 1 開始編號的預留位置規則也適用於 Fast 參考素材生成影片模型。 #### 選填 | 參數 | 型別 | 說明 | |-----------|------|-------------| | `sound` | boolean | 是否生成同步聲音。預設為 `true` | ## 素材限制 這些限制適用於本頁模型的首幀圖片、尾幀圖片和參考素材。 | 素材 | 格式 | 限制 | |-------|---------|--------| | 圖片 | JPEG, PNG, WEBP, BMP, TIFF, GIF, HEIC, HEIF | 每張圖片必須小於 30 MB;寬與高均須為 300-6000 px;寬高比須為 0.4-2.5 | | 影片 | MP4, MOV | 每段不超過 200 MB;寬與高均須為 300-6000 px;寬高比須為 0.4-2.5;影格率須為 24-60 FPS | | 音訊 | WAV, MP3 | 每段不超過 15 MB | | 請求主體 | — | 不超過 64 MB | 參考音訊與參考影片各自的總時長上限為 15 秒。各類素材數量獨立計算:最多 9 張圖片、3 段影片和 3 段音訊。加入影片不會減少可上傳的圖片數量。 所有模型預設為 `720p`,但仍必須提供 `resolution`。聲音開關預設為 `true`;此開關及參考音訊皆不影響價格。參考素材生成影片需有至少一張圖片或一段影片,不支援僅含音訊的請求。上傳參考影片會使生成費用加倍,與影片數量或時長無關。 ## 回應格式 ### 初始回應 所有模型皆回傳用於輪詢的 `task_id`: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### 輪詢回應 輪詢 `GET /api/v1/video/{taskId}` 以檢查狀態: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "videos": [ { "url": "https://example.com/generated-video.mp4" } ] } } } ``` ### 狀態值 - `submitted`:任務已接受,等待處理 - `processing`:正在生成影片 - `succeed`:影片生成完成 - `failed`:影片生成失敗 ## 處理時間 **標準模型**:3-8 分鐘,取決於時長與解析度。 **Fast 模型**:大多數設定需 1-4 分鐘。 每 5-10 秒輪詢一次以檢查狀態。 ## 最佳實務 1. **選擇合適的版本**:反覆調整時使用 Fast 模型,最終輸出使用標準模型 2. **清楚描述動作**:在提示詞中加入具體動作描述 3. **解析度選擇**:所有標準 Seedance 2.0 模型支援 `480p`、`720p`、`1080p` 和 `4k`;所有 Fast 模型僅支援 `480p` 和 `720p` 4. **參考素材順序**:依預期順序排列 `images`、`videos` 和 `audios`,並在提示詞中保持參照一致 5. **僅含影片的請求**:僅在提供至少一段參考影片時,才使用空的 `images` 陣列 6. **素材時長**:每段參考音訊和影片均維持在 2 至 15 秒之間 7. **音訊增強**:省略 `sound` 以使用預設值 `true`,或設為 `false` 以停用聲音生成