TokenLab

視頻與素材

建立素材資源 (Create Material Asset)

將 Seedance 素材資源上傳至 TokenLab 素材群組。

POST
/v1/videos/assets

將一個可公開存取的來源 URL 匯入至 Seedance 素材群組。TokenLab 會儲存該素材以供後續使用;請使用回傳的素材資源 id 進行生成,而非使用來源 URL。

對於 library_type: "aigc_avatar",group_id 為選填;若未提供,TokenLab 將使用或建立該組織的預設虛擬人像群組。對於 library_type: "liveness_face",group_id 為必填,且必須是透過 取得視覺驗證結果 所回傳的 TokenLab 群組。當 project_name 不為 default 時,group_id 同樣為必填。該群組必須屬於相同的 project_name 和 library_type,否則請求將回傳 400。

類型支援的輸入
圖片jpeg, jpg, png, webp, bmp, tiff, gif, heic, heif;≤30 MiB;寬度和高度 [300, 6000] px;長寬比 [0.4, 2.5]。
影片mp4, mov;≤200 MiB。
音訊aac, wav, mp3;≤15 MiB。

TokenLab 會在接受請求前檢查來源 URL、媒體類型、檔案大小,以及在圖片可讀取時檢查其尺寸。若來源未通過這些檢查,將回傳 400 並附帶 seedance_material_source_* 代碼,例如 seedance_material_source_invalid(圖片尺寸或長寬比超出範圍)、seedance_material_source_type_mismatch、seedance_material_source_too_large 或 seedance_material_source_url_unreachable。其他媒體和人臉要求會在處理過程中進行評估,因此請求被接受並不代表素材已準備就緒:請等待狀態變為 ACTIVE,若處理失敗則檢查 error_message。

成功的請求會回傳 201 並顯示 status: "PROCESSING"。請輪詢 取得素材資源 直到 status 變為 ACTIVE。對於真人群組,一個群組對應一個已驗證的人員;若上傳包含多張人臉或與已驗證人員不符的人臉,可能會導致失敗。

project_name 用於劃分組織內的資源,預設為 default。請在相關群組和資源中使用相同的大小寫敏感值。在 POST/PUT 請求中請將其放入 JSON 本文中,在 GET/DELETE 請求中則放入查詢字串中。

請求範例

curl https://api.tokenlab.sh/v1/videos/assets \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"library_type":"aigc_avatar","group_id":"group-20260720123456-vrt01","asset_url":"https://example.com/reference.png","asset_type":"Image","asset_name":"Front view","project_name":"default"}'

回應範例

{
  "id": "asset-20260720123456-qn7wr",
  "object": "seedance.material_asset",
  "project_name": "default",
  "group_id": "group-20260720123456-vrt01",
  "library_type": "aigc_avatar",
  "asset_name": "Front view",
  "asset_type": "Image",
  "status": "PROCESSING",
  "ready": false,
  "error_message": null,
  "metadata": null,
  "created_at": 1782998400000,
  "updated_at": 1782998400000
}
curl -X POST "https://example.com/v1/videos/assets" \  -H "Content-Type: application/json" \  -d '{    "asset_url": "https://example.com/reference.png",    "asset_name": "Front view",    "asset_type": "Image",    "library_type": "aigc_avatar",    "group_id": "group-20260720123456-vrt01"  }'
{  "id": "asset-20260720123456-qn7wr",  "object": "seedance.material_asset",  "group_id": "group-20260720123456-vrt01",  "library_type": "aigc_avatar",  "asset_name": "Front view",  "asset_type": "Image",  "status": "PROCESSING",  "ready": false,  "error_message": null,  "metadata": null,  "created_at": 1782998400000}

授權

BearerAuth
AuthorizationBearer <token>

API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。

位置: header

請求主體

application/json

回應

application/json

application/json

application/json

application/json

application/json

application/json