總覽
SeeGen AI 是統一的生成 API:透過一致的端點集合,即可執行多款頂尖 AI 影片與影像模型。只需以 model 參數選擇模型——所有模型的身分驗證、任務提交、狀態查詢與 Webhook 運作方式皆相同。
目前提供的模型:
- 影片:Seedance 2.0 Pro (
sd2)、Seedance 2.0 Fast (sd2-fast)、Seedance 2.0 Mini (sd2-mini)、Seedance 2.5 (sd2.5)、HappyHorse 1.1 (happyhorse) - 影像:GPT Image 2 (
gpt-image-2)、Nano Banana 2 (nano-banana-2)、Nano Banana Pro (nano-banana-pro)、Seedream 5.0 Lite (seedream-v5.0-lite)、Seedream 5.0 Pro (seedream-v5.0-pro)
基礎網址: https://seegen.ai/api/v1
模型: 將上述任一別名填入 model 欄位即可(例如 sd2、gpt-image-2)。
為什麼選擇 SeeGen AI?
選擇 SeeGen AI 的更多理由:
- 不只 Seedance 2.0:還有 HappyHorse 1.1、Nano Banana、ChatGPT Image 等更多模型。
- 無需訂閱——按用量付費
- 快速使用最新模型
- 全天候客戶支援
- 提供模型相關的官方諮詢支援
- 提供開發者主控台
- 企業與個人使用者皆可使用
價格
API Pack
125,000 點數 ($0.004/點數)
約 781 支 5 秒影片
API-XL Pack
500,000 點數 ($0.004/點數)
約 3,125 支 5 秒影片
Seedance 2.0 / Fast / Mini / 2.5:費用計算
設 out 為 output_seconds,in 為每支輸入影片 ⌈時長⌉ 的總和(各自無條件進位,下限為 out × 2/3)。Seedance 2.5 的計算方式與 Seedance 2.0 相同。套用任務公式前,各對應模型的基礎費率會先乘以 1.5 並取整(1080P 在 sd2.5 上為原生輸出,費率為其 720P 費率的 2.5 倍);與模型無關的升頻附加費維持 2K / 4K 每輸出秒 +30 / +40 點數(僅 sd2-fast / sd2-mini 的 1080P 為 +20)。
| 無影片輸入 | 包含影片輸入 | |
|---|---|---|
| sd2.5: 480P | 30 × out | 23 × (out + in) |
| sd2.5: 720P | 60 × out | 45 × (out + in) |
| sd2.5: 1080P (原生) | 150 × out | 113 × (out + in) |
| sd2.5: 2K | (60 + 30) × out | 45 × (out + in) + 30 × out |
| sd2.5: 4K | (60 + 40) × out | 45 × (out + in) + 40 × out |
| sd2-pro: 480P | 20 × out | 15 × (out + in) |
| sd2-pro: 720P | 40 × out | 30 × (out + in) |
| sd2-pro: 1080P (原生) | 100 × out | 75 × (out + in) |
| sd2-pro: 2K | (40 + 30) × out | 30 × (out + in) + 30 × out |
| sd2-pro: 4K (原生) | 200 × out | 150 × (out + in) |
| sd2-fast: 480P | 16 × out | 12 × (out + in) |
| sd2-fast: 720P | 32 × out | 24 × (out + in) |
| sd2-fast: 1080P | (32 + 20) × out | 24 × (out + in) + 20 × out |
| sd2-fast: 2K | (32 + 30) × out | 24 × (out + in) + 30 × out |
| sd2-fast: 4K | (32 + 40) × out | 24 × (out + in) + 40 × out |
| sd2-mini: 480P | 10 × out | 7.5 × (out + in) |
| sd2-mini: 720P | 20 × out | 15 × (out + in) |
| sd2-mini: 1080P | (20 + 20) × out | 15 × (out + in) + 20 × out |
| sd2-mini: 2K | (20 + 30) × out | 15 × (out + in) + 30 × out |
| sd2-mini: 4K | (20 + 40) × out | 15 × (out + in) + 40 × out |
備註: sd2-pro 的 1080P 與 4K 為官方原生輸出(4K = 720P 費率的 5 倍);sd2-pro 的 2K 以及所有 sd2-fast / sd2-mini 的 1080P/2K/4K 皆由 SeeGen AI 升頻產生。sd2.5 原生支援 480P/720P/1080P(1080P 費率為 720P 的 2.5 倍,不加收升頻費),2K/4K 則自動升頻。透過 outputResolution: "4k" 即可請求任一畫質(例如 "2k" / "4k";閘道會自動選擇原生或升頻——差異僅在價格與 Native 標籤)。sd2-mini 定價為 sd2-pro 的 50%,是最低成本的等級。Seedance 2.5 沿用 Seedance 2.0 的單支影片時長進位、最低輸入時長下限與升頻計算方式。任務計算前,各對應模型的基礎費率會先乘以 1.5 並取整(例如含影片的 1080P:75 × 1.5 → 113)。與模型無關的 2K / 4K 升頻附加費維持每輸出秒 +30 / +40 點數。若升頻失敗,已完成的任務會回退為 720P 版本,且不會部分退還點數。
- sd2.5 480P,4 秒輸出、無影片輸入:120 點數
- sd2.5 720P,5 秒輸出、無影片輸入:300 點數
- sd2.5 720P,5 秒輸出 + 3 秒輸入影片(最低輸入時長 4 秒):405 點數
- sd2.5 1080P 原生,5 秒輸出、無影片輸入:750 點數
- sd2.5 1080P 原生,5 秒輸出 + 5 秒輸入影片:1,130 點數
happyhorse:每秒點數
| 輸出 | 點數/秒 | 5 秒範例 |
|---|---|---|
| 720P | 32 | 160 |
| 1080P | 60 | 300 |
| 2K | 32 + 30 | 310 |
| 4K | 32 + 40 | 360 |
注意: 2K/4K 升頻是在 720P 基礎上額外加收(不會與原生 1080P 疊加)。t2v/i2v/r2v 共用相同的每秒費率——參考圖片不另計費。
🎉 限時優惠:所有圖片生成省 33%——以下所有圖片價格已含優惠。
gpt-image-2:每張圖片點數
| 解析度 | 中等品質 | 高品質 |
|---|---|---|
| 1k | 1015 | 4770 |
| 2k (預設) | 2335 | 84125 |
| 4k | 4060 | 154230 |
每個任務產生 1 張圖片,需 N 個變化請提交 N 個任務。任務失敗會自動退還點數。
nano-banana-2 與 nano-banana-pro:每張圖片點數
| 解析度 | nano-banana-2 | nano-banana-pro |
|---|---|---|
| 1k | 2030 | 4060 |
| 2k (預設) | 3045 | 4060 |
| 4k | 4770 | 74110 |
每個任務產生 1 張圖片,需 N 個變化請提交 N 個任務。任務失敗會自動退還點數。
Seedream 5.0:每張圖片點數
| 模型/級別 | 點數 |
|---|---|
| Lite 2k/4k(統一費率) | 710 |
| Pro 1k (預設) | 1015 |
| Pro 2k | 2030 |
每個任務產生 1 張圖片,需 N 個變化請提交 N 個任務。任務失敗會自動退還點數。 參考圖片不另計費。
查詢您的餘額:GET /api/v1/account/credits
身分驗證
所有 API 請求都需要在 Authorization 標頭中帶上 Bearer token。您可以在帳號設定中建立及管理 API 金鑰。
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://seegen.ai/api/v1/account/credits重要: API 金鑰僅在建立時顯示一次,請妥善保存。每個帳號最多可建立 10 組 API 金鑰。
快速開始
兩步驟生成影片:建立任務,然後輪詢取得結果。
# 1. Create a text-to-video task
TASK_ID=$(curl -s -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"inputs": {
"prompt": "A golden retriever running on the beach at sunset",
"duration": "5s",
"resolution": "1280x720"
}
}' \
https://seegen.ai/api/v1/jobs/createTask | jq -r '.taskId')
echo "Task created: $TASK_ID"
# 2. Poll for result
while true; do
RESULT=$(curl -s -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/jobs/queryTask?taskId=$TASK_ID")
STATUS=$(echo $RESULT | jq -r '.status')
echo "Status: $STATUS"
if [ "$STATUS" = "COMPLETED" ] || [ "$STATUS" = "FAILED" ]; then
echo $RESULT | jq .
break
fi
sleep 5
done端點
/api/v1/jobs/createTask建立新的影片生成任務
/api/v1/jobs/queryTask查詢任務狀態與結果
/api/v1/account/credits查詢您的點數餘額
/api/v1/assets/upload上傳素材(圖片/影片/音訊)供審核
/api/v1/assets/status查詢素材審核狀態
/api/v1/assets/list列出您已上傳的素材
/api/v1/upscale/create提交獨立的影片升頻任務(720p/1080p/2K/4K)
/api/v1/upscale/query輪詢獨立升頻任務的狀態與結果
選擇模型(影片)
兩大模型系列可生成影片,依模式與價格挑選;搭配定價章節估算費用。
| 模型 | T2V | I2V | First–Last | Multi-Ref | R2V | 原生 1080p | 原生 4K | 音訊 | 720p / 5秒 |
|---|---|---|---|---|---|---|---|---|---|
| sd2.5 | ✓ | ✓ | ✓ | ✓ | — | ✓ | 升頻 | ✓ | 300 點數 |
| sd2 | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ | ✓ | 200 點數 |
| sd2-fast | ✓ | ✓ | ✓ | ✓ | — | 升頻 | 升頻 | ✓ | 160 點數 |
| sd2-mini | ✓ | ✓ | ✓ | ✓ | — | 升頻 | 升頻 | ✓ | 100 點數 |
| happyhorse | ✓ | ✓ | — | — | ✓ | ✓ | 升頻 | ✓ | 160 點數 |
T2V = 文字轉影片 · I2V = 圖片轉影片(首格) · First–Last = 首尾影格 · Multi-Ref = 混合圖片/影片/音訊參考 · R2V = 1–9 張帶角色標記的參考圖片
Seedance 2.0 / 2.0 Fast / 2.0 Mini / Seedance 2.5
文字轉影片
根據文字提示詞生成影片,無需提供圖片。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"inputs": {
"prompt": "A futuristic city with flying cars at night, neon lights reflecting on wet streets",
"duration": "5s",
"resolution": "1280x720"
}
}' \
https://seegen.ai/api/v1/jobs/createTask| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 要生成影片的文字描述,最多 20000 字元。 |
| duration | string | 否 | 影片長度:"4s" 到 "15s";sd2.5 最長支援到 "30s"(預設:"5s") |
| resolution | string | 否 | 透過解析度指定長寬比。可選值:auto(預設)、720x720、720x960、960x720、1280x720、720x1280、1280x540 |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
| seed | int | 否 | 可重現性種子值:填 -1 或省略即為隨機;填 0–2147483647 之間的數值可固定結果。 |
| generateAudio | boolean | 否 | 是否合成同步音軌。預設為 true;傳入 false 則產生無聲影片。 |
圖片轉影片
將靜態圖片動畫化為影片,提供一個圖片網址作為起始影格。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"inputs": {
"urls": ["https://example.com/photo.jpg"], // or "asset://asset-20260326-abc123"
"prompt": "The woman slowly turns her head and smiles",
"duration": "5s"
}
}' \
https://seegen.ai/api/v1/jobs/createTask| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| urls | string[] | 是 | 包含一個圖片網址(來源影格)的陣列。同時支援 HTTP 網址與資產參照(例如 "asset://asset-20260326-abc123") |
| prompt | string | 否 | 描述所需動態效果的文字說明 |
| duration | string | 否 | 影片長度:"4s" 到 "15s";sd2.5 最長支援到 "30s"(預設:"5s") |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
| seed | int | 否 | 可重現性種子值:填 -1 或省略即為隨機;填 0–2147483647 之間的數值可固定結果。 |
| generateAudio | boolean | 否 | 是否合成同步音軌。預設為 true;傳入 false 則產生無聲影片。 |
首尾影格
定義起始與結束影格,模型會生成兩者之間的過渡動畫。需使用 videoInputMode: "keyframe"。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"inputs": {
"urls": [
"https://example.com/first-frame.jpg",
"https://example.com/last-frame.jpg"
],
"prompt": "Smooth camera transition from day to night",
"duration": "5s",
"videoInputMode": "keyframe"
}
}' \
https://seegen.ai/api/v1/jobs/createTask| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| urls | string[] | 是 | 剛好包含 2 個圖片網址的陣列:[first_frame, last_frame]。同時支援 HTTP 網址與資產參照(例如 "asset://asset-20260326-abc123") |
| videoInputMode | string | 是 | 必須為 "keyframe" |
| prompt | string | 否 | 引導過渡效果的文字描述 |
| duration | string | 否 | 影片長度:"4s" 到 "15s";sd2.5 最長支援到 "30s"(預設:"5s") |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
| seed | int | 否 | 可重現性種子值:填 -1 或省略即為隨機;填 0–2147483647 之間的數值可固定結果。 |
| generateAudio | boolean | 否 | 是否合成同步音軌。預設為 true;傳入 false 則產生無聲影片。 |
多重參考
使用多張參考圖片、影片與音訊檔案來引導生成。需使用 videoInputMode: "reference"。對 sd2.5 而言,這是預設的參考子任務;若要編輯或延續現有影片,請參閱下方的「影片編輯與延伸」。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"inputs": {
"urls": [
"https://example.com/ref1.jpg",
"https://example.com/ref2.jpg"
],
"videoUrls": ["asset://asset-motion-video"],
"audioUrls": ["https://example.com/audio.mp3"],
"prompt": "Character walks through a garden",
"duration": "5s",
"videoInputMode": "reference",
"resolution": "1280x720"
}
}' \
https://seegen.ai/api/v1/jobs/createTask| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| urls | string[] | 否 | 參考圖片網址(最多 9 張)。同時支援 HTTP 網址與資產參照(例如 "asset://asset-20260326-abc123") |
| videoUrls | string[] | 否 | 參考影片的 asset:// URI——需先透過 /api/v1/assets/upload 上傳,外部網址一律拒絕。sd2:最多 3 支影片,每支 ≤15s。sd2.5:最多 10 支影片,每支 2–30s 且 ≤200MB,參考總時長 ≤30s,支援 480p–4K 輸入。 |
| audioUrls | string[] | 否 | 參考音訊輸入。sd2 / sd2-fast / sd2-mini:最多 3 個音訊檔案,每個 2–15s,總長 ≤15s——這些模型不支援僅以音訊作為參考(須至少加入一張圖片或一支影片)。sd2.5:最多 10 個檔案,每個 ≤15MB 且 2–30s,總長 ≤30s,且支援僅音訊輸入。 |
| videoInputMode | string | 是 | 必須為 "reference" |
| prompt | string | 否 | 文字描述 |
| duration | string | 否 | 影片長度:"4s" 到 "15s";sd2.5 最長支援到 "30s"(預設:"5s") |
| resolution | string | 是 | 參考模式下必填。可選值:720x720、720x960、960x720、1280x720、720x1280、1280x540 |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
| seed | int | 否 | 可重現性種子值:填 -1 或省略即為隨機;填 0–2147483647 之間的數值可固定結果。 |
| generateAudio | boolean | 否 | 是否合成同步音軌。預設為 true;傳入 false 則產生無聲影片。 |
參考限制
- 最多 9 張圖片、3 支影片、3 個音訊檔案
- 所有類型合計最多 12 個檔案
- 每支影片/每個音訊檔案須 ≤ 15 秒
- 圖片最短邊須至少 400px
- sd2.5:最多 30 張圖片、10 支影片、10 個音訊檔案,總數上限 50;影片與音訊各自總長皆 ≤ 30 秒
影片編輯與延伸
sd2.5 將基於參考素材的生成拆分為三個子任務。一般參考生成請省略 mode;編輯現有影片請設定 mode: "edit";延續影片請設定 mode: "extend"。兩者都需要 videoUrls 中至少一支影片,且輸出始終沿用來源影片的長寬比。
請將要操作的影片放在 videoUrls 的第一個位置,並在提示詞中稱它為「Video 1」。edit 會強制輸出長度與該第一支(來源)影片一致,其長度須為 4–30 秒,因此您傳入的任何 duration 都會被忽略;計費以來源影片長度作為輸出長度,並將所有參考影片計入輸入。extend 接受依序串接的 1–3 段影片,您所要求的 duration 即為本次生成的輸出長度(與來源長度無關)——計費方式與一般參考生成相同。
2.0 系列模型(sd2 / sd2-fast / sd2-mini)同樣接受 mode: "edit" 與 mode: "extend":它們會從您的提示詞推斷操作內容(請明確描述編輯或延續方式),長寬比沿用來源影片,duration 則仍由您自行控制,計費方式為一般計費。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2.5",
"inputs": {
"mode": "edit",
"videoUrls": ["asset://asset-source-video"],
"urls": ["https://example.com/annotation-at-1.2s.png"],
"source_frame_timestamps_ms": [1200],
"prompt": "Replace the marked object with a red umbrella",
"outputResolution": "720p"
}
}' \
https://seegen.ai/api/v1/jobs/createTask| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| mode | string | 否 | 「edit」或「extend」。一般參考生成請省略此項。 |
| videoUrls | string[] | 是 | 至少一支影片;第一支為來源(「Video 1」)——編輯的輸出長度與計費皆以它為準。之後的影片則作為額外參考(edit)或依序串接的附加片段(extend,最多 3 支)。 |
| urls | string[] | 否 | 選填的標註/參考圖片。 |
| source_frame_timestamps_ms | number[] | 否 | 僅限 mode「edit」使用。urls 中每張圖片對應一個非負的來源影片時間戳(毫秒)。 |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
Seedance 參數參考
sd2 / sd2-fast / sd2-mini / sd2.5 模型全部 inputs 參數的完整參考。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 否 | 文字描述(文字轉影片為必填,其他模式為選填)。最多 20000 個字元。 |
| urls | string[] | 否 | 圖片網址。支援 HTTP 網址與素材參考(例如 "asset://asset-20260326-abc123")。內部對應至 uploadedUrls。 |
| videoUrls | string[] | 否 | 影片參考的 asset:// URI(僅限參考模式)。須先透過 /api/v1/assets/upload 上傳——外部網址會被拒絕。 |
| audioUrls | string[] | 否 | 音訊參考網址(僅限參考模式)。sd2.5 支援僅音訊輸入;sd2 / sd2-fast / sd2-mini 除音訊外,還須搭配至少一張圖片或一支影片。 |
| duration | string | 否 | 一般為 "4s" 至 "15s";sd2.5 最高支援 "30s"。預設值:"5s" |
| resolution | string | 否 | 長寬比:auto(預設)| 720x720 | 720x960 | 960x720 | 1280x720 | 720x1280 | 1280x540 |
| outputResolution | string | 否 | 輸出解析度等級:"480p"、"720p"(預設)、"1080p"、"2k" 或 "4k"。各模型的原生解析度不同:Seedance 2.0 Pro:480p/720p/1080p/4k;Seedance 2.0 Fast 與 Mini:480p/720p;Seedance 2.5:480p/720p/1080p。超過原生解析度的等級將自動升頻。 |
| videoInputMode | string | 否 | "keyframe"(預設)或 "reference" |
| mode | string | 否 | 參考模式子任務(適用所有 Seedance 模型):一般參考生成請省略;"edit" 表示編輯 videoUrls 中的第一支影片;"extend" 表示延續 1–3 段影片。詳見「影片編輯與延伸」。 |
| source_frame_timestamps_ms | number[] | 否 | 僅限 sd2.5 影片編輯:每張標註圖片對應一個非負的時間戳(毫秒)。 |
| seed | int | 否 | 用於重現結果的隨機種子。設為 -1 或省略即由伺服器隨機產生。相同種子加相同輸入會得到高度相近的結果(因 GPU 的非確定性,並非位元級完全相同)。範圍:-1 至 2147483647。 |
| generateAudio | boolean | 否 | 是否合成與影片同步的音軌(語音、音效、背景音樂)。預設為 true。設為 false 可產生無聲影片——速度稍快,適合日後另行配音的情境。 |
| bitrateMode | string | 否 | 同解析度下的輸出位元率等級:"standard"(預設)或 "high"。「high」能保留更多細節、減少色帶/區塊瑕疵,檔案大小約為原本的 3-5 倍——不會改變解析度或價格。 |
| upscaleResolution | string | 否 | (已淘汰)舊版拆分欄位,為向下相容仍可使用。新串接建議改用 outputResolution,現已可直接傳入 "2k" / "4k"。若兩者同時傳入,以 upscaleResolution 為準——但在原生支援 1080p 的模型(Seedance2 Pro / Seedance 2.5)上,upscaleResolution:"1080p" 會解析為原生 1080p(依原生費率計費)。 |
頂層請求欄位:model(必填)、inputs(必填)、callBackUrl(選填的 webhook 網址)。
素材
素材是指圖片、影片與音訊檔案,在用於影片生成任務前須先經過審核流程。上傳素材後,等待其狀態變為 ACTIVE,接著即可在任務中使用其 asset:// 網址。
注意:真人圖片與影片素材需經官方審核,通常在數秒內完成。審核通過後即可直接作為參考使用。未經審核可能導致生成失敗。
上傳素材
有兩種上傳方式:直接傳送本機檔案(multipart/form-data),或提交可公開存取的 HTTPS 網址。無論哪種方式,系統都會自動處理並審核該素材。
方法 A:直接上傳檔案(multipart/form-data)
傳送本機檔案,無需圖床。媒體類型會依檔案位元組偵測(不採信檔名副檔名)。允許類型:圖片(jpg/png/webp/gif/bmp/tiff/heic)、影片(mp4/mov)、音訊(wav/mp3)。單檔最大 50MB(圖片 ≤30MB、影片 ≤50MB、音訊 ≤15MB)。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-F "file=@/path/to/photo.jpg" \
-F "name=my-photo" \
https://seegen.ai/api/v1/assets/upload| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| file | file | 是 | 本機檔案(multipart 表單欄位)。媒體類型依內容偵測。 |
| name | string | 否 | 素材名稱(最多 64 個字元) |
方法 B:透過網址(application/json)
適用於檔案已託管於公開 HTTPS 網址的情況。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.jpg",
"type": "IMAGE",
"name": "my-photo"
}' \
https://seegen.ai/api/v1/assets/upload| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| url | string | 是 | 要上傳檔案的公開可存取 HTTPS URL |
| type | string | 是 | 「IMAGE」、「AUDIO」或「VIDEO」 |
| name | string | 否 | 素材名稱(最多 64 個字元) |
上傳回應
{
"assetId": 123,
"volcAssetId": "asset-20260326-abc123",
"type": "IMAGE",
"status": "PROCESSING",
"failReason": null,
"url": "https://example.com/photo.jpg",
"name": "my-photo",
"createdAt": 1711234567890
}查詢素材狀態
輪詢素材的審核狀態。當狀態為 PROCESSING 時,此端點會自動向審核系統查詢最新狀態。
# Query by asset ID (numeric)
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/assets/status?assetId=123"
# Query by volcAssetId (string)
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/assets/status?assetId=asset-20260326-abc123"素材狀態值
PROCESSING— 審核中,尚無法使用ACTIVE— 審核通過,可用於任務FAILED— 審核失敗,請查看 failReason
列出素材
列出您已上傳的素材,可依類型與狀態選擇性篩選,支援游標分頁。
# List all assets
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/assets/list"
# Filter by type and status
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/assets/list?type=IMAGE&status=ACTIVE&limit=10"
# Paginate with cursor
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/assets/list?cursor=100&limit=20"| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| type | string | 否 | 依類型篩選:「IMAGE」、「AUDIO」或「VIDEO」 |
| status | string | 否 | 依狀態篩選:「NONE」、「PROCESSING」、「ACTIVE」或「FAILED」 |
| cursor | number | 否 | 分頁用游標(使用上一次回應中的 nextCursor) |
| limit | number | 否 | 每頁筆數,1-50(預設:20) |
列表回應
{
"items": [
{
"assetId": 123,
"volcAssetId": "asset-20260326-abc123",
"type": "IMAGE",
"status": "ACTIVE",
"failReason": null,
"url": "https://example.com/photo.jpg",
"name": "my-photo",
"width": 1920,
"height": 1080,
"size": 245000,
"duration": null,
"createdAt": 1711234567890
}
],
"nextCursor": 122
}在任務中使用素材
當素材狀態為 ACTIVE 後,即可在任務的 URL 中以 asset:// 協定搭配其 volcAssetId 使用:
{
"model": "sd2",
"inputs": {
"urls": ["asset://asset-20260326-abc123"],
"prompt": "The person slowly looks up and smiles",
"duration": "5s"
}
}HappyHorse 1.1(阿里巴巴)
來自阿里巴巴 DashScope 的替代影片生成模型,支援三種模式:文字轉影片、首格圖片轉影片,以及參考圖轉影片(每次提示可融合 1–9 張參考圖;在提示詞中以 character1、character2… 指代對應主體)。HappyHorse 1.1 不支援末格、參考影片或參考音訊。模型名稱:happyhorse。
無需素材審核——您可以直接使用公開的 HTTPS 圖片 URL,或傳入素材庫中的 asset:// 參照(系統會自動解析回原始 R2 URL)。
文字轉影片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse",
"inputs": {
"prompt": "A panda DJ at a beach party, smoky sunset",
"duration": "5s",
"outputResolution": "720p",
"ratio": "16:9"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉影片(首格)
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse",
"inputs": {
"urls": ["https://example.com/panda.jpg"],
"prompt": "The panda blinks and smiles",
"duration": "5s",
"outputResolution": "1080p"
}
}' \
https://seegen.ai/api/v1/jobs/createTask參考圖轉影片(1–9 張參考圖)
傳入 videoWorkflowTab: "multi-reference" 並附上 1–9 張參考圖 URL,即可將多個主體融合為單一輸出結果。在提示詞中以 character1、character2… 指代對應圖片(順序需與 urls 一致)。長寬比由 ratio 欄位控制(因無首格可供推導)。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse",
"inputs": {
"videoWorkflowTab": "multi-reference",
"urls": [
"https://example.com/character.jpg",
"https://example.com/folding-fan.jpg",
"https://example.com/earrings.jpg"
],
"prompt": "A woman in red character1 opening folding fan character2, with tassel earrings character3 swinging",
"duration": "5s",
"outputResolution": "720p",
"ratio": "16:9"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskHappyHorse 參數參考
happyhorse 模型所有 inputs 參數的完整參考。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 否 | 文字描述。文字轉影片與參考圖轉影片為必填;圖片轉影片為選填。非中日韓字元上限 5000 字,中日韓字元上限 2500 字(超出上游會自動截斷)。在 r2v 中使用 character1/character2/… 指代第 N 張參考圖。 |
| urls | string[] | 否 | t2v:省略。i2v:恰好 1 個 URL(作為首格)。r2v:1–9 個 URL。支援公開 HTTPS URL 與素材參照(例如「asset://asset-20260326-abc123」)。 |
| videoWorkflowTab | string | 否 | 設為「multi-reference」以啟用參考圖轉影片模式(須搭配 1 個以上的 urls)。文字轉影片/圖片轉影片可省略此欄位。 |
| duration | string | 否 | 「3s」至「15s」(預設「5s」)。 |
| outputResolution | string | 否 | 「720p」(預設)或「1080p」。 |
| ratio | string | 否 | 「16:9」/「9:16」/「1:1」/「4:3」/「3:4」。用於文字轉影片與參考圖轉影片——圖片轉影片的長寬比由首格推導而得。 |
| seed | int | 否 | 0 至 2147483647。留空則使用隨機種子。 |
圖片要求(i2v/r2v)
- 最短邊 ≥ 300px
- 長寬比介於 1:2.5 至 2.5:1 之間
- 格式:JPEG、JPG、PNG、BMP、WEBP
- 每張圖片檔案大小上限 10MB(r2v:1–9 張輸入圖片各自適用)
選擇模型(圖片)
圖片模型接收提示詞(可選擇附上參考圖片),每個任務回傳一張圖片。每次請求依所選模型的等級計費(Seedream Lite 為統一定價)。失敗的任務會自動退款。沒有批次參數——若要產生多個變化版本,請針對每張圖片各呼叫一次 createTask。
| 模型 | T2I | I2I(編輯) | 多參考圖 | 最大解析度 | 2k / medium |
|---|---|---|---|---|---|
| gpt-image-2 | ✓ | ✓ | 最多 10 張 | 4k | 見價格頁 |
| nano-banana-2 | ✓ | ✓ | 最多 10 張 | 4k | 見價格頁 |
| nano-banana-pro | ✓ | ✓ | 最多 10 張 | 4k | 見價格頁 |
| seedream-v5.0-lite | ✓ | ✓ | 最多 10 張 | 4k | 統一定價 |
| seedream-v5.0-pro | ✓ | ✓ | 最多 10 張 | 2k | 見價格頁 |
GPT Image 2
OpenAI 的 GPT Image 2 模型,適用於高品質文字轉圖片與圖片轉圖片編輯。單一流程即可支援兩種模式——傳入 urls 會自動切換為編輯模式。輸出結果會以您指定的格式(PNG / JPEG / WEBP)透過 R2 提供。模型名稱:gpt-image-2。
文字轉圖片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"inputs": {
"prompt": "A neon-lit cyberpunk alley at midnight, photoreal",
"quality": "medium",
"resolution": "2k",
"aspectRatio": "16:9"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉圖片(編輯)
透過 urls 傳入 1–10 張參考圖片。模型會將其作為 prompt 所述編輯內容的視覺參考。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"inputs": {
"urls": ["https://example.com/portrait.jpg"],
"prompt": "Restyle as oil painting",
"quality": "medium",
"resolution": "1k",
"aspectRatio": "1:1"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskGPT Image 2 參數參考
gpt-image-2 模型所有 inputs 參數的完整參考。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 欲生成圖片的文字描述,或在提供 urls 時所要套用的編輯指示。 |
| urls | string[] | 否 | 圖片轉圖片(編輯)模式的參考圖片 URL(1–10 張)。文字轉圖片模式請省略。僅接受公開 HTTPS URL。 |
| quality | string | 否 | 「medium」/「high」。預設值:「medium」。點數依等級計費(見價格頁)。 |
| resolution | string | 否 | 「1k」/「2k」/「4k」。預設值:「2k」。點數依等級計費(見價格頁)。 |
| aspectRatio | string | 否 | 「1:1」/「16:9」/「9:16」/「4:3」/「3:4」。預設值:「1:1」。 |
| outputFormat | string | 否 | 「png」/「jpeg」/「webp」。預設值:「png」。 |
輸入圖片要求(圖片轉圖片模式)
- 每個任務最多 10 張參考圖片
- 每張圖片檔案大小上限 50 MB
- 最短邊 ≥ 256px
- 長寬比介於 1:3 至 3:1 之間
- 格式:JPEG、JPG、PNG、WEBP
每張圖片的點數依解析度與品質而異——完整表格請見價格章節。
Nano Banana 2
Nano Banana 2 是高保真圖片模型,長寬比涵蓋範圍比 gpt-image-2 更廣——新增直向/橫向預設(3:2、2:3、4:5、5:4)與電影感 21:9。單一流程即可支援兩種模式——傳入 urls 會自動切換為編輯模式。模型名稱:nano-banana-2。
文字轉圖片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"inputs": {
"prompt": "A neon-lit cyberpunk alley at midnight, photoreal",
"resolution": "2k",
"aspectRatio": "16:9"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉圖片(編輯)
透過 urls 傳入 1–10 張參考圖片。模型會將其作為 prompt 所述編輯內容的視覺參考。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"inputs": {
"urls": ["https://example.com/portrait.jpg"],
"prompt": "Restyle as oil painting",
"resolution": "2k",
"aspectRatio": "1:1"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskNano Banana 2 參數參考
nano-banana-2 模型所有 inputs 參數的完整參考。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 欲生成圖片的文字描述,或在提供 urls 時所要套用的編輯指示。 |
| urls | string[] | 否 | 圖片轉圖片(編輯)模式的參考圖片 URL(1–10 張)。文字轉圖片模式請省略。僅接受公開 HTTPS URL。 |
| resolution | string | 否 | 「1k」/「2k」/「4k」。預設值:「2k」。點數依等級計費(見價格頁)。 |
| aspectRatio | string | 否 | 「1:1」/「16:9」/「9:16」/「4:3」/「3:4」/「3:2」/「2:3」/「4:5」/「5:4」/「21:9」。預設值:「1:1」。 |
輸入圖片要求(圖片轉圖片模式)
- 每個任務最多 10 張參考圖片
- 每張圖片檔案大小上限 50 MB
- 最短邊 ≥ 256px
- 長寬比介於 1:3 至 3:1 之間
- 格式:JPEG、JPG、PNG、WEBP
每張圖片的點數依解析度而異——完整表格請見價格章節。
Nano Banana Pro
Nano Banana Pro 是高保真圖片模型,長寬比涵蓋範圍比 gpt-image-2 更廣——新增直向/橫向預設(3:2、2:3、4:5、5:4)與電影感 21:9。單一流程即可支援兩種模式——傳入 urls 會自動切換為編輯模式。模型名稱:nano-banana-pro。
文字轉圖片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-pro",
"inputs": {
"prompt": "A neon-lit cyberpunk alley at midnight, photoreal",
"resolution": "2k",
"aspectRatio": "16:9"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉圖片(編輯)
透過 urls 傳入 1–10 張參考圖片。模型會將其作為 prompt 所述編輯內容的視覺參考。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-pro",
"inputs": {
"urls": ["https://example.com/portrait.jpg"],
"prompt": "Restyle as oil painting",
"resolution": "2k",
"aspectRatio": "1:1"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskNano Banana Pro 參數參考
nano-banana-pro 模型所有 inputs 參數的完整參考。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 欲生成圖片的文字描述,或在提供 urls 時所要套用的編輯指示。 |
| urls | string[] | 否 | 圖片轉圖片(編輯)模式的參考圖片 URL(1–10 張)。文字轉圖片模式請省略。僅接受公開 HTTPS URL。 |
| resolution | string | 否 | 「1k」/「2k」/「4k」。預設值:「2k」。點數依等級計費(見價格頁)。 |
| aspectRatio | string | 否 | 「1:1」/「16:9」/「9:16」/「4:3」/「3:4」/「3:2」/「2:3」/「4:5」/「5:4」/「21:9」。預設值:「1:1」。 |
輸入圖片要求(圖片轉圖片模式)
- 每個任務最多 10 張參考圖片
- 每張圖片檔案大小上限 50 MB
- 最短邊 ≥ 256px
- 長寬比介於 1:3 至 3:1 之間
- 格式:JPEG、JPG、PNG、WEBP
每張圖片的點數依解析度而異——完整表格請見價格章節。
Seedream 5.0 Lite
以 2K 或 4K 快速生成文字轉圖片與圖片轉圖片,支援 15 種長寬比。模型名稱:seedream-v5.0-lite。
文字轉圖片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-v5.0-lite",
"inputs": {
"prompt": "A cinematic product photograph, soft studio light",
"resolution": "2k",
"aspectRatio": "1:1"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉圖片(編輯)
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-v5.0-lite",
"inputs": {
"prompt": "Restyle the references as a premium fashion campaign",
"urls": ["https://example.com/reference.png"],
"resolution": "4k",
"aspectRatio": "3:4"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskSeedream 5.0 Lite 參數
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 圖片描述或編輯指示。 |
| urls | string[] | 否 | 1–10 個公開 HTTPS 參考圖片 URL。文字轉圖片模式請省略。 |
| resolution | string | 否 | 「2k」或「4k」。預設值:「2k」。 |
| aspectRatio | string | 否 | 「1:1」、「1:2」、「2:1」、「1:3」、「3:1」、「2:3」、「3:2」、「3:4」、「4:3」、「4:5」、「5:4」、「9:16」、「16:9」、「9:21」或「21:9」。 |
Seedream 5.0 Pro
以 1K 或 2K 進行高保真生成與編輯。模型名稱:seedream-v5.0-pro。
文字轉圖片
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-v5.0-pro",
"inputs": {
"prompt": "Editorial portrait with dramatic rim lighting",
"resolution": "2k",
"aspectRatio": "3:4"
}
}' \
https://seegen.ai/api/v1/jobs/createTask圖片轉圖片(編輯)
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-v5.0-pro",
"inputs": {
"prompt": "Turn the reference into a cinematic poster",
"urls": ["https://example.com/reference.png"],
"resolution": "2k",
"aspectRatio": "1:2"
}
}' \
https://seegen.ai/api/v1/jobs/createTaskSeedream 5.0 Pro 參數
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| prompt | string | 是 | 圖片描述或編輯指示。 |
| urls | string[] | 否 | 1–10 個公開 HTTPS 參考圖片 URL。文字轉圖片模式請省略。 |
| resolution | string | 否 | 「1k」或「2k」。預設值:「1k」。不支援 4k。 |
| aspectRatio | string | 否 | 「1:1」、「1:2」、「2:1」、「1:3」、「3:1」、「2:3」、「3:2」、「3:4」、「4:3」、「4:5」、「5:4」、「9:16」、「16:9」、「9:21」或「21:9」。 |
影片放大工具
建立任務
POST /api/v1/upscale/create
# source.url accepts ANY https video URL — your own CDN, OR a file you first
# uploaded to us via /api/v1/assets/upload (pass the r2Url it returns). No need
# to declare which: we detect it. External URLs are validated; our own are trusted.
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": { "type": "url", "url": "https://your-cdn.com/video.mp4" },
"targetResolution": "2k",
"callBackUrl": "https://your-server.com/webhook"
}' \
https://seegen.ai/api/v1/upscale/create| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| source.type | string | 是 | 任何來源都使用 "url"。("uploadId" 是為了向下相容而保留的舊版別名。) |
| source.url | string | 否 | 搭配 type="url" 使用。任何 https 影片網址皆可——您自己的 CDN,或 /api/v1/assets/upload 回傳的 r2Url。外部網址若使用 http 或私有/內部 IP 會被拒絕(SSRF 防護);我們自家素材主機上的網址則會略過此檢查。 |
| source.r2Url | string | 否 | 舊版欄位——僅搭配 type="uploadId" 使用(向下相容)。新串接請改用 type="url"。 |
| targetResolution | string | 是 | "720p"、"1080p"、"2k" 或 "4k"。必須高於來源解析度。 |
| callBackUrl | string | 否 | 任務進入最終狀態(完成或失敗)時觸發一次的 Webhook 網址。 |
建立回應
{
"taskId": "n770mo4sh6rpi690ff3gwymx",
"orderId": "ord_2026...",
"status": "validating"
}查詢狀態
GET /api/v1/upscale/query?taskId=...
狀態流程為 validating → processing → completed / failed。
curl -H "Authorization: Bearer $API_KEY" \
"https://seegen.ai/api/v1/upscale/query?taskId=n770mo4sh6rpi690ff3gwymx"完成回應
{
"taskId": "n770mo4sh6rpi690ff3gwymx",
"status": "completed",
"targetResolution": "2k",
"creditsConsumed": 900,
"result": {
"url": "https://static.seegen.ai/standalone-upscale/results/...mp4",
"probedDurationSeconds": 30,
"probedSourceResolution": "1280x720"
},
"error": null,
"createdAt": "2026-04-29T01:23:45.000Z",
"finishedAt": "2026-04-29T01:35:01.000Z"
}失敗回應
{
"taskId": "n770mo4sh6rpi690ff3gwymx",
"status": "failed",
"creditsConsumed": null,
"result": null,
"error": {
"code": "SOURCE_RESOLUTION_TOO_HIGH",
"message": "Source 3840x2160 is not below target 4k"
}
}限制
- 來源:https 網址或您先前上傳的 R2 網址
- 長度最多 600 秒(未滿 5 秒的片段按 5 秒計費)
- 檔案大小 ≤ 200 MB
- 格式:MP4 / MOV / WebM
- 來源解析度必須低於目標解析度
價格
- 720P:17 點數/秒(5 秒 = 85,30 秒 = 510)
- 1080P:25 點數/秒(5 秒 = 125,30 秒 = 750)
- 2K:38 點數/秒(5 秒 = 190,30 秒 = 1140)
- 4K:50 點數/秒(5 秒 = 250,30 秒 = 1500)
- 最低收費 5 秒;失敗會自動退還點數
錯誤代碼
以下是可直接處理的常見錯誤。其他失敗會回傳意義清楚的 message 欄位——在假設是以下代碼之前,請先讀取該欄位。
| 代碼 | 意義 |
|---|---|
| INVALID_URL | 網址格式錯誤或非 https |
| URL_NOT_REACHABLE | 無法取得該網址——請確認網址公開且可存取 |
| UNSUPPORTED_MEDIA_TYPE | 檔案並非影片,或格式不是 MP4 / MOV / WebM |
| FILE_TOO_LARGE | 來源檔案超過 200 MB |
| DURATION_EXCEEDS_LIMIT | 來源長度超過 600 秒 |
| SOURCE_RESOLUTION_TOO_HIGH | 來源解析度已達到或超過目標——請選擇更高的目標解析度 |
| INSUFFICIENT_CREDITS | 點數不足——請儲值後再試 |
Webhook 回呼
除了輪詢之外,您也可以提供 callBackUrl,在任務完成或失敗時自動接收結果。
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd2",
"callBackUrl": "https://your-server.com/webhook/callback",
"inputs": {
"prompt": "A cat playing piano",
"duration": "5s"
}
}' \
https://seegen.ai/api/v1/jobs/createTask回呼內容
任務完成時,我們會以與 queryTask 回應相同的格式,向您的網址發送 POST 請求:
// POST to your callBackUrl
{
"taskId": "task_abc123",
"model": "sd2",
"status": "COMPLETED",
"creditsUsed": 200,
"output": [
{
"url": "https://static.seegen.ai/videos/result.mp4",
"width": 1280,
"height": 720
}
],
"error": null,
"createTime": 1711234567890,
"completeTime": 1711234612345
}重試機制: 若您的端點回傳非 2xx 狀態,我們會以遞增延遲(1 秒、5 秒、30 秒)重試最多 3 次。
回應格式
createTask 回應
// 200 OK
{ "taskId": "task_abc123" }queryTask 回應
{
"taskId": "task_abc123",
"model": "sd2",
"status": "COMPLETED", // "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED"
"creditsUsed": 200,
"output": [ // null when status is not "COMPLETED"
{
"url": "https://static.seegen.ai/videos/result.mp4",
"width": 1280,
"height": 720
}
],
"error": null, // error message when status is "FAILED"
"createTime": 1711234567890,
"completeTime": 1711234612345
}credits 回應
{
"credits": 5000,
"availableCredits": 4800
}錯誤處理
| 狀態碼 | 含義 | 處理方式 |
|---|---|---|
| 400 | 參數無效 | 檢查錯誤訊息並修正您的請求 |
| 401 | API 金鑰無效或缺失 | 檢查 Authorization 標頭格式 |
| 402 | 點數不足 | 前往 seegen.ai 購買更多點數 |
| 403 | 存取被拒 | 您只能查詢自己的任務 |
| 404 | 找不到任務 | 確認 taskId 是否正確 |
| 429 | 並行數量限制(3 個任務) | 等待現有任務完成 |
| 500 | 伺服器內部錯誤 | 幾秒後重試 |
提交前驗證(400 附錯誤碼)
Seedance 請求在扣除任何點數前,會先依上游規範進行檢查。檢查未通過時,createTask 會回傳 HTTP 400 及 { "message": "...", "code": "..." },且不會建立任務。訊息會準確說明觸發了哪項限制以及如何修正。
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| EMPTY_CONTENT | code | 否 | 沒有提示詞,也沒有參考圖片/影片/音訊。 |
| AUDIO_ONLY_NOT_SUPPORTED | code | 否 | 在 sd2 / sd2-fast / sd2-mini 上,音訊不能作為唯一參考。請加入圖片或影片,或改用 sd2.5(支援純音訊)。 |
| DURATION_OUT_OF_RANGE | code | 否 | duration 不是模型範圍內的整數(sd2 系列為「4s」至「15s」,sd2.5 為「4s」至「30s」)。 |
| EDIT_SOURCE_VIDEO_REQUIRED / EXTEND_SOURCE_VIDEO_REQUIRED | code | 否 | 請求了 "edit" / "extend" 模式,但 videoUrls 中沒有影片。 |
| EDIT_SOURCE_DURATION_INVALID | code | 否 | sd2.5 Video Edit:請求中的某個影片短於 4 秒或長於 30 秒(ARK 對編輯任務的每個影片都套用 4–30 秒的限制)。 |
| TOO_MANY_REFERENCES | code | 否 | 參考圖片/影片/音訊片段數量超過模型上限(sd2 系列為 9 / 3 / 3,sd2.5 為 30 / 10 / 10;extend 模式最多 3 支影片)。 |
| REFERENCE_VIDEO_DURATION_INVALID | code | 否 | 某個參考影片超過單支上限(sd2 系列 15 秒,sd2.5 30 秒),或參考影片總時長超過上限(15 秒 / 30 秒)。 |
| ASSET_NOT_FOUND / EXTERNAL_URL / READ_TIMEOUT / READ_FAILED | code | 否 | videoUrls 中的某個項目無法對應到您已上傳的素材,或無法讀取其時長。 |
完整範例
完整流程:上傳素材、等待審核、以已核准的素材建立任務,並輪詢結果。
const API_KEY = process.env.API_KEY;
const BASE = "https://seegen.ai/api/v1";
const headers = {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
};
// 1. Upload asset and wait for review
// (To upload a LOCAL file instead of a URL, POST multipart/form-data with a "file"
// field — no Content-Type header, no "type" — see the Upload Asset section above.)
async function uploadAndWaitForAsset(url, type = "IMAGE") {
const res = await fetch(`${BASE}/assets/upload`, {
method: "POST",
headers,
body: JSON.stringify({ url, type }),
});
if (!res.ok) throw new Error(`Upload failed: ${(await res.json()).message}`);
const asset = await res.json();
console.log(`Asset uploaded: ${asset.assetId}, status: ${asset.status}`);
// Poll until review completes
while (true) {
const statusRes = await fetch(
`${BASE}/assets/status?assetId=${asset.assetId}`,
{ headers }
);
const status = await statusRes.json();
if (status.status === "ACTIVE") {
console.log(`Asset approved: asset://${status.volcAssetId}`);
return status.volcAssetId;
}
if (status.status === "FAILED") {
throw new Error(`Asset review failed: ${status.failReason}`);
}
await new Promise((r) => setTimeout(r, 3000));
}
}
// 2. Create a task
async function createTask(inputs, callBackUrl) {
const res = await fetch(`${BASE}/jobs/createTask`, {
method: "POST",
headers,
body: JSON.stringify({
model: "sd2",
inputs,
...(callBackUrl && { callBackUrl }),
}),
});
if (!res.ok) throw new Error(`[${res.status}] ${(await res.json()).message}`);
return res.json();
}
// 3. Poll until done
async function waitForResult(taskId, timeoutMs = 300000) {
const start = Date.now();
while (Date.now() - start < timeoutMs) {
const res = await fetch(
`${BASE}/jobs/queryTask?taskId=${taskId}`,
{ headers }
);
const result = await res.json();
if (result.status === "COMPLETED") return result;
if (result.status === "FAILED") throw new Error(result.error);
await new Promise((r) => setTimeout(r, 5000));
}
throw new Error("Timeout waiting for task");
}
// Full workflow: upload → review → generate → result
async function main() {
// Upload image and wait for review
const volcAssetId = await uploadAndWaitForAsset(
"https://example.com/photo.jpg", "IMAGE"
);
// Create task with approved asset
const { taskId } = await createTask({
urls: [`asset://${volcAssetId}`],
prompt: "The person slowly looks up and smiles",
duration: "5s",
});
console.log(`Task: ${taskId}`);
// Wait for video
const result = await waitForResult(taskId);
console.log(`Video: ${result.output[0].url}`);
}
main().catch(console.error);