Seedance 報價與帳單收據
估算 Seedance 生成成本,並使用經過驗證的持久化帳單收據核對最終扣款。
Seedance 報價與帳單收據
適用於 seedance-2.0、seedance-2.5、seedance-2.0-fast 與 seedance-2.0-mini,涵蓋所有生成管道。基礎 URL:https://apimaster.ai/v1(https://apimaster.ai/v1)。所有請求皆須以 Authorization: Bearer YOUR_API_KEY 進行驗證。
取得估算
POST https://apimaster.ai/v1/videos/quote 接受與標準影片生成請求相同的 JSON 參數,包括 model、prompt、duration、resolution、video_urls 及其他支援的生成設定。目前不支援草稿生成、草稿升級與重混(remix)報價。
curl "https://apimaster.ai/v1/videos/quote" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"seedance-2.0","prompt":"A paper boat on a pond","duration":4,"resolution":"480p","generate_audio":false}'
回應包含 object: "video.quote"、quote_id、expires_at(Unix 秒)、binding: false、funds_reserved: false,以及下方說明的 billing 物件。報價具有五分鐘的參考性有效期限。它不會扣款、建立任務,也不會啟動供應商生成。因此 billing.reserved_amount 為 "0.000000"。報價 ID 僅供參考;它不是授權或價格鎖定憑證,也無需隨生成請求一併提交。
價格會在實際提交時重新計算,並針對該任務凍結。估算並非最高收費保證。完成的任務可能高於或低於估算金額。自動時長請求使用 30 秒輸出的估算值;requested_output_seconds 為 -1。
生成仍須通過供應商驗證。對於 Seedance 2.5 影片延伸請求,請明確設定 aspect_ratio: "adaptive";供應商拒絕會透過正常的退款生命週期處理。
取得任務收據
curl "https://apimaster.ai/v1/videos/task_xxx/billing" \
-H "Authorization: Bearer YOUR_API_KEY"
GET /v1/videos/{task_id}/billing 會回傳 object: "video.billing_receipt" 與 billing。只有屬於任務擁有者帳戶的 API 金鑰才能取得。未知、外部及沒有收據的歷史任務會回傳 HTTP 404。收據僅為此功能啟用後建立的新任務產生;較舊的任務不會追溯重建。
相同的 billing 物件也包含在兩種任務查詢回應中:
GET /v1/videos/{task_id}:頂層的billing。GET /v1/video/generations/{task_id}:data.billing。
settlement_status 為 pending、settled 或 refunded;報價回應則使用 estimate。任務完成與財務結算是分開的:只有在收據狀態為 settled 或 refunded 時,金額才應視為最終值。重複的收據請求不會執行生成、結算或退款。已定案的收據會保留相同的收據 ID 與內容,包括退款之後亦然。
完整的請求與回應範例
兩個範例皆使用 Seedance 2.0 的 480P 解析度、請求 4 秒輸出、一個測得 4.042 秒的參考影片、管道乘數 1 與帳戶乘數 1.05。完成時長與金額來自實際測試;報價則是以相符輸入所組成的說明性範例。ID 與媒體 URL 為佔位符。實際費率以你的 API 回應為準。
1. 取得報價
POST https://apimaster.ai/v1/videos/quote,請求 JSON:
{
"model": "seedance-2.0",
"prompt": "A paper boat moves gently on a pond.",
"duration": 4,
"resolution": "480p",
"video_urls": [
"https://example.com/reference.mp4"
]
}
| 欄位 | 型別 | 說明 |
|---|---|---|
model |
string | 模型 ID,此處為 seedance-2.0。 |
prompt |
string | 生成提示詞。 |
duration |
integer | 請求的輸出秒數,而非參考影片時長。 |
resolution |
string | 輸出解析度,此處為 480p。 |
video_urls |
array |
參考影片 URL。請以可存取的媒體取代佔位符;伺服器會測量每個檔案。 |
報價回應:
{
"object": "video.quote",
"quote_id": "quote_example",
"expires_at": 1790949324,
"binding": false,
"funds_reserved": false,
"billing": {
"schema_version": "1",
"settlement_status": "estimate",
"model": "seedance-2.0",
"resolution": "480P",
"tariff_variant": "480P-input",
"tariff_revision": "sd-v1-b79a35d3a29af9af",
"currency": "USD",
"unit": "second",
"base_unit_rate": "0.04319",
"channel_multiplier": 1,
"account_multiplier": 1.05,
"effective_unit_rate": "0.0453495",
"requested_output_seconds": 4,
"estimated_output_seconds": 4,
"estimated_billable_seconds": 9,
"input_videos": [
{
"index": 0,
"media_id": "media_example_hash",
"measured_seconds": 4.042,
"billable_seconds": 5,
"duration_source": "apimaster_probe"
}
],
"billable_input_video_seconds": 5,
"output": null,
"billable_seconds": null,
"rounding": {
"amount_formula": "round(total_billable_seconds * effective_unit_rate / account_unit_usd) * account_unit_usd",
"effective_unit_rate": "nearest_decimal_12_places_half_up",
"input_video": "ceil_each_file_then_sum",
"money": "nearest_account_unit_half_up",
"output_video": "nearest_integer_half_up"
},
"estimated_amount": "0.408146",
"reserved_amount": "0.000000",
"additional_debit_amount": "0.000000",
"final_debit_amount": null,
"refunded_amount": "0.000000",
"net_amount": null,
"initial_quota_units": 0,
"final_quota_units": null,
"account_unit_usd": "0.000002",
"media_charges": {
"audio": "0.000000",
"image": "0.000000",
"input_video_unrounded": "0.2267475",
"other_reference": "0.000000",
"output_video_unrounded": "0.181398"
},
"final_debit_may_exceed_estimate": true,
"created_at": 1790949024,
"settled_at": null
}
}
4.042 秒的輸入會無條件進位為 5 秒。以 4 秒的估算輸出計算,估算涵蓋 9 秒,費用為 0.408146 USD。報價不會扣款;最終金額仍為 null。
2. 提交生成並查詢完成狀態
提交至 POST https://apimaster.ai/v1/videos/generations 後,初始回應包含任務 ID:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example"
}
]
}
接著使用同一帳戶的 API 金鑰查詢 GET https://apimaster.ai/v1/videos/task_example。生成與結算完成後:
{
"actual_time": 189,
"billing": {
"schema_version": "1",
"receipt_id": "bill_task_example",
"task_id": "task_example",
"settlement_status": "settled",
"model": "seedance-2.0",
"resolution": "480P",
"tariff_variant": "480P-input",
"tariff_revision": "sd-v1-b79a35d3a29af9af",
"currency": "USD",
"unit": "second",
"base_unit_rate": "0.04319",
"channel_multiplier": 1,
"account_multiplier": 1.05,
"effective_unit_rate": "0.0453495",
"requested_output_seconds": 4,
"estimated_output_seconds": 4,
"estimated_billable_seconds": 9,
"input_videos": [
{
"index": 0,
"media_id": "media_example_hash",
"measured_seconds": 4.042,
"billable_seconds": 5,
"duration_source": "apimaster_probe"
}
],
"billable_input_video_seconds": 5,
"output": {
"actual_seconds": 4,
"billable_seconds": 4,
"duration_source": "provider_reported"
},
"billable_seconds": 9,
"rounding": {
"amount_formula": "round(total_billable_seconds * effective_unit_rate / account_unit_usd) * account_unit_usd",
"effective_unit_rate": "nearest_decimal_12_places_half_up",
"input_video": "ceil_each_file_then_sum",
"money": "nearest_account_unit_half_up",
"output_video": "nearest_integer_half_up"
},
"estimated_amount": "0.408146",
"reserved_amount": "0.408146",
"additional_debit_amount": "0.000000",
"final_debit_amount": "0.408146",
"refunded_amount": "0.000000",
"net_amount": "0.408146",
"initial_quota_units": 204073,
"final_quota_units": 204073,
"account_unit_usd": "0.000002",
"media_charges": {
"audio": "0.000000",
"image": "0.000000",
"input_video_unrounded": "0.2267475",
"other_reference": "0.000000",
"output_video_unrounded": "0.181398"
},
"final_debit_may_exceed_estimate": true,
"created_at": 1790949024,
"settled_at": 1790949213
},
"completed_at": 1790949213,
"created_at": 1790949024,
"id": "task_example",
"metadata": {
"url": "https://apimaster.ai/v1/videos/task_example/content"
},
"model": "seedance-2.0",
"object": "video",
"progress": 100,
"status": "completed",
"task_id": "task_example",
"usage": {
"completion_tokens": 80770
}
}
此處初始扣款等於最終費用,沒有額外扣款或退款。billing.output.actual_seconds 為輸出時長;actual_time 為處理時間。usage.completion_tokens 不決定收費金額。選用欄位可能因管道而異。
GET https://apimaster.ai/v1/videos/task_example/billing 會回傳 { "object": "video.billing_receipt", "billing": ... },其中包含相同的 billing 物件。相容性查詢 GET https://apimaster.ai/v1/video/generations/task_example 則會將其置於 data.billing 之下。
外層回應欄位
| 欄位 | 型別 | 說明 |
|---|---|---|
object |
string | 回應型別:video.quote、video 或 video.billing_receipt。 |
quote_id |
string | 僅供參考的報價識別碼;並非價格鎖定或生成授權。 |
expires_at |
integer | 參考性的報價到期時間(Unix 秒),通常為建立時間加 300 秒。 |
binding |
boolean | 目前為 false;報價不保證最終金額。 |
funds_reserved |
boolean | 目前為 false;報價不會扣款或保留資金。 |
billing |
object | 帳單詳細資料,於下方逐一說明。 |
code |
integer | 提交回應代碼;200 表示已提交,而非已完成。 |
data |
array | 已提交的任務清單;相容性查詢則以物件作為 data。 |
data[].status |
string | 提交狀態,此範例中為 submitted。 |
data[].task_id |
string | 用於後續查詢的公開任務識別碼。 |
id |
string | 完成查詢中的公開任務 ID。 |
task_id |
string | 任務識別碼,此範例中與 id 相同。 |
model |
string | 公開的生成模型名稱。 |
status |
string | 任務狀態;completed 表示生成已完成。請檢查 billing.settlement_status 以確認最終結算。 |
progress |
number | 進度百分比;此範例中完成時為 100。 |
actual_time |
number | 任務處理秒數,而非輸出影片時長。 |
created_at |
integer | 任務建立時間戳記(Unix 秒)。 |
completed_at |
integer | 任務完成時間戳記(Unix 秒)。 |
metadata |
object | 生成結果中繼資料。 |
metadata.url |
string | 影片內容下載 URL。 |
usage |
object | 供應商用量資訊;視管道而定可能不存在。 |
usage.completion_tokens |
integer | 供應商 token 數量;不作為這四種模型按秒計費的依據。 |
帳單結構
所有貨幣金額與單位費率皆為十進位字串。時間時長以秒為單位。可為 null 的欄位在可用之前為 JSON null。
| 欄位 | 型別 | 說明 |
|---|---|---|
schema_version |
string | 帳單結構版本,此範例中為 "1"。 |
receipt_id |
string | 穩定的收據識別碼;報價中不存在。 |
task_id |
string | 與收據關聯的公開任務 ID;報價中不存在。 |
settlement_status |
string | estimate、pending、settled、refunded |
model |
string | 套用的公開模型 ID。 |
resolution |
string | 用於計費的正規化解析度。 |
tariff_variant |
string | 費率層級;-input 表示影片參考,此費率同時套用於輸入與輸出。 |
tariff_revision |
string | 模型、費率層級、已設定的基礎費率與計費規則版本的指紋 |
currency |
string | 收費貨幣,目前為 USD。 |
unit |
string | 費率的單位;second 表示每秒。 |
base_unit_rate |
decimal string | 此模型與層級的已設定基礎每秒價格。 |
channel_multiplier |
number | 套用的整體管道定價乘數。 |
account_multiplier |
number | 套用的帳戶/群組乘數,此範例中為 1.05。 |
effective_unit_rate |
decimal string | 套用的每秒費率,於提交時凍結並四捨五入至 12 位小數。 |
requested_output_seconds |
integer | 請求的輸出時長;自動時長為 -1 |
estimated_output_seconds |
integer | 估算的輸出秒數;自動時長估算為 30 秒。 |
estimated_billable_seconds |
integer | 初始估算的總計費秒數,包含參考影片與估算輸出。 |
input_videos |
array | 每個參考影片的伺服器測量結果,依請求順序排列 |
input_videos[].index |
integer | 參考影片在請求中的位置,從零開始。 |
input_videos[].media_id |
string | 帳戶範圍的媒體雜湊或自有資產 ID;不會回顯參考影片 URL。 |
input_videos[].measured_seconds |
number 或 null | 四捨五入前的伺服器測量時長;較舊的快取資產可能為 null |
input_videos[].billable_seconds |
integer | 此參考影片四捨五入後的計費時長 |
input_videos[].duration_source |
string | apimaster_probe 或 apimaster_asset_cache |
billable_input_video_seconds |
integer | 各參考影片計費秒數的總和 |
output |
object 或 null | 最終輸出時長資訊,於成功結算後可用 |
output.actual_seconds |
number 或 null | 實際回報/探測的輸出時長;無法取得時為 null |
output.billable_seconds |
integer | 結算中實際使用的輸出秒數 |
output.duration_source |
string | provider_reported、apimaster_probe、provider_billable_seconds、requested_duration_fallback 或 reservation_fallback |
billable_seconds |
integer 或 null | 最終合併的輸入/輸出計費秒數 |
rounding |
object | 輸入、輸出與金額的四捨五入規則及金額公式 |
estimated_amount |
decimal string | 初始估算成本,並非最終金額或最高收費保證。 |
reserved_amount |
decimal string | 提交時的初始帳戶扣款,報價為零;並非銀行授權保留。 |
additional_debit_amount |
decimal string | 最終成本超過初始扣款時的額外扣款。 |
final_debit_amount |
decimal string 或 null | 調整後的最終任務淨成本;全額退款後為零 |
net_amount |
decimal string 或 null | 調整後的最終任務淨成本;全額退款後為零 |
refunded_amount |
decimal string | 從初始扣款退還的金額;全額退款時等於初始扣款。 |
initial_quota_units |
integer | 初始扣款的確切帳戶單位數;報價為零。 |
final_quota_units |
integer 或 null | 最終淨成本的確切帳戶單位數;待處理時為 null,全額退款後為零。 |
account_unit_usd |
decimal string | 每個帳戶單位 "0.000002" |
media_charges |
object | 目前費率下 image、audio、other_reference 皆為零;input_video_unrounded 與 output_video_unrounded 在最終貨幣四捨五入前分開影片組成部分 |
final_debit_may_exceed_estimate |
boolean | true;估算並非硬性支出上限 |
created_at |
integer | 帳單詳細資料建立時間戳記(Unix 秒)。 |
settled_at |
integer 或 null | 最終結算或退款時間戳記(Unix 秒);定案前為 null。 |
| 欄位 | 型別 | 說明 |
|---|---|---|
rounding.input_video |
string | ceil_each_file_then_sum:先將每個輸入檔案無條件進位,再相加。 |
rounding.output_video |
string | nearest_integer_half_up:最接近的輸出整數秒,半秒無條件進位。 |
rounding.effective_unit_rate |
string | nearest_decimal_12_places_half_up:將有效費率四捨五入至 12 位小數。 |
rounding.money |
string | nearest_account_unit_half_up:將合併金額四捨五入至帳戶單位。 |
rounding.amount_formula |
string | 最終合併金額公式;輸入與輸出金額不會分開四捨五入。 |
media_charges.input_video_unrounded |
decimal string | 貨幣四捨五入前的輸入影片組成部分。 |
media_charges.output_video_unrounded |
decimal string | 貨幣四捨五入前的輸出影片組成部分。 |
media_charges.image |
decimal string | 獨立的圖片附加費,目前為零。 |
media_charges.audio |
decimal string | 獨立的音訊附加費,目前為零。 |
media_charges.other_reference |
decimal string | 其他參考附加費,目前為零。 |
重新計算最終成本
使用參考影片時,影片輸入費率層級同時套用於輸出與參考影片秒數。在目前的 Seedance 費率下,圖片與音訊沒有獨立附加費。Token 數量與供應商成本並非計費輸入。
- 將每個輸入影片的測量時長獨立無條件進位,再相加:
input_seconds = sum(ceil(each_video_duration))。 - 將輸出時長四捨五入至最接近的整數秒,正半秒無條件進位。
- 將輸入與輸出的計費秒數相加。
- 乘以
effective_unit_rate,除以account_unit_usd,然後將總額一次四捨五入至最接近的整數帳戶單位,正半單位無條件進位。
final_quota_units = round_half_up(billable_seconds × effective_unit_rate / 0.000002)
net_amount = final_quota_units × 0.000002
net_amount = reserved_amount + additional_debit_amount - refunded_amount
請使用十進位運算。請勿將輸入與輸出的貨幣組成部分分開四捨五入。例如,一個 4 秒的 Seedance 2.0 任務,480P、無參考影片、基礎費率 0.07031、管道乘數 1、帳戶乘數 1.05,其有效費率為 0.0738255,淨成本為 0.295302 USD(147651 個帳戶單位)。
APIMaster 會測量參考影片時長,而非信任 input_seconds 或 reference_seconds 等用戶端欄位。請求的 duration/seconds 控制輸出時長。對於輸出,結算會優先採用供應商回報的時長,並在需要時探測輸出;無法取得的測量結果可能退回使用供應商計費秒數或請求/保留時長。收據會明確標示來源。退回值絕不會被標示為獨立測量的實際時長。現有的快取資產或繼承的較舊草稿可能缺少完整的逐檔測量詳細資料。
影片回應中的 actual_time 是任務處理時間,而非輸出影片時長。usage.completion_tokens(若存在)僅供參考。
失敗與退款
供應商任務失敗以及設定的 24 小時未完成任務逾時會觸發自動全額退款。其收據仍可取得,且一旦退款成功,會顯示 refunded 且淨金額為零。暫時性的輪詢/網路錯誤不會立即退款或取消任務;處理會重試。
已確認未收費的提交失敗會退款。結果不明的提交會保留以進行自動對帳(首次非同步對帳約在 20 分鐘後;24 小時後仍未知的結果會在對帳期間退款)。若提交未建立公開任務,則該次嘗試沒有任務關聯的收據。報價並非保留,無需釋放。
沒有公開的 Seedance 取消端點。中斷連線或停止輪詢不會取消任務。任務狀態檢查可防止重複輪詢再次套用相同的完成結算/退款,而收據端點本身為唯讀。這些並非針對每種基礎設施失敗的全面性恰好一次保證;待處理的財務操作不得視為已定案。
