Seedance 視頻生成 API 參考
以 bytedance/seedance-2.0(Seedance 2.0)為例,演示提交任務、輪詢狀態與下載成片的完整呼叫流程。
注意: Seedance 2.0 支援多時長與 480p / 720p / 1080p 解析度;流程為提交任務 → 輪詢 job_id → 使用查詢結果中的 download_url 下載成片。
示例模型
下文均以 bytedance/seedance-2.0(Seedance 2.0)為例;更換其他模型時,請替換 model 參數,並參考控制台模型說明調整 size、quality 等欄位。
提交視頻生成任務
POST
https://token.easyapi.com/v1/videos提交異步視頻生成任務,成功返回 202 及 job_id 供後續輪詢狀態。建議傳入 Idempotency-Key 以防重複建立。
請求參數
| 名稱 | 位置 | 類型 | 必選 | 說明 |
|---|---|---|---|---|
Authorization | header | string | 是 | EasyAPI API Key。格式:Bearer `API_KEY` |
Content-Type | header | string | 是 | 請求體格式 |
Idempotency-Key | header | string | 否 | 冪等鍵,相同 key 重複提交時返回首次建立的任務,不會重複建立 |
請求體
| 名稱 | 類型 | 必選 | 說明 |
|---|---|---|---|
model | string | 是 | 模型 ID,目前使用 bytedance/seedance-2.0 |
prompt | string | 是 | 視頻描述,建議包含主體、動作、場景、鏡頭和風格。不同模型上限不同:Sora 500 字,Hailuo 2000 字,Wan T2V 1500 字、I2V 800 字。EasyAPI 本身不設硬性上限,超出後由上游拒絕並透傳 502 / 503。 |
duration | integer | 否 | 視頻時長(秒),取值範圍隨模型不同 |
resolution | string | 否 | 輸出解析度:480p、720p 或 1080p |
aspect_ratio | string | 否 | 寬高比:16:9、4:3、1:1、3:4、9:16、21:9 或 adaptive |
generate_audio | boolean | 否 | 是否生成音訊 |
seed | integer | 否 | 隨機種子,-1 到 4294967295;相同 seed 不保證完全一致 |
size | string | 否 | 精確輸出尺寸,如 1280x720 |
input_references | array | 否 | 可選參考素材陣列,用於圖生視頻、首尾幀驅動、視頻風格遷移或音訊驅動生成 |
input_references[].type | string | 是 | 參考素材類型:image、video 或 audio,必須與 role 匹配 |
input_references[].url | string | 是 | 參考素材的 HTTPS 地址 |
input_references[].role | string | 是 | 參考素材用途。可選值:first_frame(首幀圖)、last_frame(尾幀圖)、reference(外觀參考圖,影響生成但不作首幀、不鎖定畫面位置)、reference_video(參考視頻)、reference_audio(參考音訊) |
metadata | object | 否 | 業務透傳欄位,用於審計或來源標記 |
webhook_url | string | 否 | 任務完成或失敗後的回調地址 |
示例
{
"model": "bytedance/seedance-2.0",
"prompt": "A golden retriever running on a sunny beach, cinematic camera movement",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
"generate_audio": false,
"seed": -1,
"input_references": [
{
"type": "image",
"url": "https://cdn.example.com/portrait.jpg",
"role": "first_frame"
}
],
"metadata": {
"source": "playground"
},
"webhook_url": "https://example.com/webhooks/easyapi-video"
}返回欄位說明
| 名稱 | 類型 | 說明 |
|---|---|---|
job_id | string | 任務唯一 ID |
status | string | 任務狀態:pending / in_progress / completed / failed |
model | string | 使用的模型 |
status_url | string | 查詢任務狀態的完整 URL |
message | string | 服務端提示資訊 |
current_balance | string | 當前帳戶餘額(USD) |
estimated_cost | string | 預估費用 |
pre_deduct_amount | string | 預扣展示金額 |
balance_after_estimate | string | 按預估費用計算後的餘額 |
currency | string | 貨幣類型,目前為 USD |
billing_notice | string | 計費提示 |
返回示例
{
"code": 200,
"msg": "",
"data": {
"job_id": "video_abc123",
"status": "in_progress",
"model": "bytedance/seedance-2.0",
"status_url": "https://token.easyapi.com/v1/videos/video_abc123",
"message": "视频任务已提交,请调用 status_url 查询生成进度。",
"current_balance": "100.0000000000",
"estimated_cost": "1.0800000000",
"pre_deduct_amount": "1.0800000000",
"balance_after_estimate": "98.9200000000",
"currency": "USDT",
"billing_notice": "视频生成完成后按实际任务结果扣款,提交后请保持余额充足。"
}
}返回結果
| 狀態碼 | 狀態碼含義 | 說明 | 資料模型 |
|---|---|---|---|
202 | Accepted | 任務已提交並排隊,響應中包含用於輪詢的 job_id。 | VideoSubmitResponse |
400 | Bad Request | 參數錯誤 | ErrorResponse |
401 | Unauthorized | 未登入或 Token 無效 | ErrorResponse |
402 | Payment Required | 餘額不足,響應中包含預估費用與當前餘額。 | ErrorResponse |
429 | Too Many Requests | 請求過於頻繁,請降低呼叫頻率。 | ErrorResponse |
500 | Internal Server Error | 服務內部錯誤 | ErrorResponse |
查詢任務狀態
GET
https://token.easyapi.com/v1/videos/{job_id}示例請求: https://token.easyapi.com/v1/videos/video_abc123
輪詢任務狀態、進度及計費資訊。任務完成後響應中包含 download_url。
請求參數
| 名稱 | 位置 | 類型 | 必選 | 說明 |
|---|---|---|---|---|
job_id | path | string | 是 | 視頻任務 ID |
Authorization | header | string | 是 | EasyAPI API Key。格式:Bearer `API_KEY` |
返回欄位說明
| 名稱 | 類型 | 說明 |
|---|---|---|
job_id | string | 任務唯一 ID |
status | string | 任務狀態:pending / in_progress / completed / failed |
model | string | 使用的模型 |
status_url | string | 查詢任務狀態的完整 URL |
download_url | string | 視頻下載入口 URL(狀態為 completed 後出現) |
duration | integer | 視頻時長(秒) |
resolution | string | 輸出解析度 |
aspect_ratio | string | 寬高比 |
generate_audio | boolean | 是否包含音訊 |
estimated_cost | string | 預估費用 |
billed_cost | string | 實際扣費金額 |
billing_status | string | 計費狀態:pre_deducted 或 settled |
expires_at | string(ISO 8601) | 視頻檔案過期時間 |
created_at | string(ISO 8601) | 任務建立時間 |
completed_at | string(ISO 8601) | 任務完成時間 |
返回示例
{
"code": 200,
"msg": "",
"data": {
"job_id": "video_abc123",
"status": "completed",
"model": "bytedance/seedance-2.0",
"status_url": "https://token.easyapi.com/v1/videos/video_abc123",
"download_url": "https://cdn.example.com/videos/video_abc123.mp4",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
"generate_audio": false,
"estimated_cost": "1.0800000000",
"billed_cost": "1.0800000000",
"billing_status": "settled",
"expires_at": "2026-06-26T05:00:00Z",
"created_at": "2026-05-27T05:00:00Z",
"completed_at": "2026-05-27T05:03:00Z"
}
}返回結果
| 狀態碼 | 狀態碼含義 | 說明 | 資料模型 |
|---|---|---|---|
200 | OK | 成功 | VideoStatusResponse |
401 | Unauthorized | 未登入或 Token 無效 | ErrorResponse |
404 | Not Found | 任務不存在,或任務不屬於當前 API Key。 | ErrorResponse |
500 | Internal Server Error | 服務內部錯誤 | ErrorResponse |