提交影片任務

非同步文生 / 圖生影片, 支援 Seedance 全系

POST /v1/videos/generations

鉴权: {'type': 'bearer', 'prefix': 'sk-', 'description': 'API Key, 使用 `Authorization: Bearer sk-xxx` 鉴权'}

## Seedance 影片生成 字節 Seedance 全系 (BytePlus ModelArk) 非同步影片生成. **提交立即返回 task_id**, 終態由 GET 查詢介面拿. ### 主要特性 - **BytePlus 原生協議透傳**: body 欄位跟 BytePlus 官方文件 1:1 對應 (`content` / `ratio` / `duration` / `generate_audio` / `seed` 等), 0 協議轉換, 0 欄位魔改 - **影片時長**: 統一支援 **4-15 秒** 範圍 (各模型實際上限不同, 超出時上游會返 400) - **音訊生成**: Seedance 2.0 / 2.0 Fast / 1.5 Pro 支援 `generate_audio: true` - **圖生影片 / 影片續寫**: 通過 `content[]` 陣列傳 `image_url` / `video_url` block (Seedance 2.0 V2V) - **Draft 預覽**: Seedance 1.5 Pro 支援 `draft_task` 續推 ### 官方文件 請參考 [BytePlus 官方文件](https://docs.byteplus.com/en/docs/ModelArk/2291680) 欄位語義 / 模型差異 / 錯誤碼 全部跟官方一致. ### 呼叫流程 1. POST `/v1/videos/generations` → 立即返 `task_id` + `status=processing` 2. GET `/v1/videos/generations/{task_id}` 輪詢 → 拿到 `succeeded` + `content[].video_url` 3. 終態 succeeded / failed — 平臺 5 表自動記帳 (扣費 / 退款鏈路完整閉環) 詳細欄位說明 + 5 個模型矩陣 + V2V / A2V / Draft 用法見: [Seedance 影片生成 (詳細)](#seedance-video-detailed)

请求体

modelstringrequiredSeedance 模型 ID. 全部 5 個變體: - dreamina-seedance-2-0-260128 (頂級, 支援 V2V/A2V) - dreamina-seedance-2-0-fast-260128 (快速) - seedance-1-5-pro-251215 (Draft 預覽) - seedance-1-0-pro-250528 (旗艦平衡) - seedance-1-0-pro-fast-251015 (經濟快速) - dreamina-seedance-2-0-mini-260615 (輕量經濟, 支援 V2V)
contentarrayBytePlus 原生輸入陣列 (推薦主用法). 5 種 type: - text: { type:"text", text:"..." } 文本提示詞 - image_url: { type:"image_url", image_url:{ url, role:"first_frame"|"last_frame"|"reference_image" } } 圖生影片 - video_url: { type:"video_url", video_url:{ url, role:"reference_video" } } 影片續寫 (Seedance 2.0) - audio_url: { type:"audio_url", audio_url:{ url } } 音訊生影片 (Seedance 2.0 A2V) - draft_task: { type:"draft_task", draft_task:{ task_id } } Draft 續推 (Seedance 1.5 Pro) 如果不傳, endpoint 會從.
resolutionstring解析度
ratiostringBytePlus 原生寬高比
durationinteger影片時長 (秒). 統一範圍 4-15s, 各模型實際上限不同 (超出時上游返 400). 具體見 [BytePlus 官方文件](https://docs.byteplus.com/en/docs/ModelArk/2291680)
generate_audioboolean生成同步音訊 (BytePlus 原生欄位). 僅 Seedance 2.0 / 2.0 Fast / 1.5 Pro 支援
seedinteger隨機種子 (0~2^32-1), 固定後同 prompt 可復現相似影片
waitbooleantrue=阻塞模式 (最長 60s 同步等結果), false=非同步立即返回 task_id (推薦)

响应

调用示例

curl -X POST https://api.router.ai/v1/videos/generations \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dreamina-seedance-2-0-260128",
    "content": [{ "type": "text", "text": "一只猫在海边奔跑" }],
    "ratio": "16:9",
    "duration": 5
  }' 

## 錯誤處理 | HTTP 狀態碼 | 錯誤類型 | 描述 | |---|---|---| | 400 | `InvalidParameter` | 參數錯誤 | | 400 | `InvalidParameter.MissingRequired` | 必填欄位未提供 (e.g. prompt / model / content[]) | | 400 | `InvalidParameter.NotInEnum` | 列舉值非法 (resolution / aspect_ratio / role 等) | | 400 | `InvalidParameter.UnsupportedImageFormat` | 圖片格式不支援 | | 400 | `InvalidParameter.UnsupportedVideoFormat` | 影片格式不支援 | | 400 | `InvalidParameter.UnsupportedAudioFormat` | 音訊格式不支援 | | 400 | `InvalidParameter.ImageSizeTooLarge` | 圖片體積超上游單檔案限制 | | 400 | `InvalidParameter.VideoSizeTooLarge` | 輸入影片體積超限 | | 400 | `InvalidParameter.VideoDurationTooLong` | 輸入影片時長超上限 | | 400 | `InvalidParameter.PromptTooLong` | prompt 字元數超模型上限 | | 400 | `InvalidParameter.UrlNotAccessible` | 上游下載客戶提供的 image_url/video_url 失敗 | | 400 | `InvalidParameter.UrlInvalid` | URL 格式非法 (非 http(s) / 字元錯) | | 400 | `InvalidParameter.AspectRatioMismatch` | aspect_ratio 與輸入圖比例不一致 | | 400 | `InvalidParameter.ResolutionNotSupported` | 該模型不支援指定 resolution | | 400 | `InvalidParameter.DurationOutOfRange` | duration 超模型支援範圍 | | 400 | `InvalidParameter.ContentEmpty` | prompt / content[] 全空 | | 400 | `InvalidParameter.UnsupportedRole` | content[].role 非法 | | 400 | `InvalidParameter.DataInspectionFailed` | 輸入資料規格檢查失敗 (跟內容稽核不同維度) | | 400 | `DataInspectionFailed` | 同上無字首變體 | | 400 | `InputImageSensitiveContentDetected` | 輸入圖片包含敏感內容 (主類) | | 400 | `InputTextSensitiveContentDetected` | prompt 包含敏感內容 (主類, 子分類同 Image) | | 400 | `InputVideoSensitiveContentDetected` | 輸入影片包含敏感內容 | | 400 | `InputAudioSensitiveContentDetected` | 輸入音訊包含敏感內容 | | 400 | `invalid_request_error` | 平臺參數校驗失敗 (模型類型不匹配 / 必填欄位缺失等) | | 401 | `unauthorized` | 無效或缺失. 檢查 Bearer sk-xxx header | | 402 | `insufficient_balance` | 餘額不足, 充值後重試 | | 403 | `permission_denied` | 模型未授權 / Token 被禁 / Token 過期 | | 404 | `model_not_found` | 模型名拼錯或已下架 | | 404 | `ResourceNotFound` | 任務 ID 不存在或已過 BytePlus 7-8 天保留期被清理 | | 409 | `idempotency_conflict` | 同請求短時間重複提交, 等幾秒重試或修改參數 | | 429 | `rate_limit_exceeded` | RPM/TPM 限流, 看 `Retry-After` header 退避 | | 429 | `RateLimitExceeded` | 上游限流 | | 429 | `Throttling` | 上游限流, 同 RateLimitExceeded | | 429 | `ConcurrencyExceeded` | 單時刻併發超 max_concurrent, 減少併發 | | 500 | `internal_error` | 平臺服務端錯 | | 500 | `InternalError` / `InternalServerError` | 上游內部錯, 同上重試策略 | | 502 | `service_unavailable` | 上游通道全不可用 | | 502 | `BadGateway` | 上游閘道器錯 | | 503 | `ServiceUnavailable` | 上游服務暫不可達 | | 504 | `RequestTimeout` / `ModelTimeoutException` | 上游推理超時 |

API 文件