視頻與素材
取得任務 (Volc 相容)
透過 cgt 任務 ID 取得 Seedance 相容性任務。
概覽
使用建立任務時回傳的 cgt-... ID。當任務狀態為 queued 或 running 時,請每隔幾秒進行輪詢。當任務狀態變為 succeeded、failed、cancelled 或 expired 時請停止輪詢。
請勿在此處重複使用統一的 v1 任務列舉 (enum) 或回應結構。/v1/tasks/{id} 使用 pending、processing、completed 和 failed;此 v3 端點使用上述官方列舉。在 v3 JSON 物件中,duration 在存在時為字串,error 為選填欄位,並在可用時包含錯誤詳細資訊。嚴謹的 Go 客戶端應將 Duration 宣告為 string 並加上 JSON 標籤 duration,omitempty,並在遇到任何 v3 終止狀態時停止。
請參閱 Seedance 2.0 影片模型 與 影片生成。
狀態值
queued: 已接受並等待執行。running: 正在生成中。succeeded: 結果已就緒,且content.video_url存在。failed: 生成失敗;請檢查error.code和error.message。cancelled: 任務在完成前已被取消。expired: 任務在完成前已過期。
回應欄位
id: 相容性任務 ID,以cgt-開頭。model: 您在建立任務時傳送的model值。status: 上述狀態值之一。content.video_url: 成功時的最終影片 URL。這是一個 TokenLab 結果連結,有效期為 30 天;請參閱 資料保留。content.last_frame_url: 僅在請求且可用時提供。usage: 可用時提供completion_tokens和total_tokens,以及當網路搜尋工具執行時的tool_usage.web_search。created_at與updated_at: 以秒為單位的 Unix 時間戳記。error: 當錯誤詳細資訊可用時顯示{ code, message }。請勿僅根據status推斷其存在。- 任務設定的請求值在可用時會被回傳:
seed、resolution、ratio、duration(字串)、generate_audio、service_tier、execution_expires_after、safety_identifier、tools、draft、draft_task_id、frames以及framespersecond。
回應永遠不會新增 TokenLab 欄位,例如 progress、return_last_frame、watermark、priority 或 camera_fixed。
未知或已過期的任務 ID 會回傳 404;屬於其他組織的 ID 會回傳 403。
範例
curl https://api.tokenlab.sh/api/v3/contents/generations/tasks/cgt-20260102030405-a1b2c \
-H "Authorization: Bearer $TOKENLAB_API_KEY"{
"id": "cgt-20260102030405-a1b2c",
"model": "seedance-2.0",
"status": "succeeded",
"content": {
"video_url": "https://api.tokenlab.sh/v1/media-results/3f2b8c1e-6d4a-4e9b-8a7c-2d5e1f0b9c4a.mp4?token=…"
},
"usage": {
"completion_tokens": 123456
}
}type SeedanceTask struct {
ID string `json:"id"`
Status string `json:"status"`
Duration string `json:"duration,omitempty"`
}
func isTerminal(status string) bool {
switch status {
case "succeeded", "failed", "cancelled", "expired":
return true
default:
return false
}
}curl -X GET "https://example.com/api/v3/contents/generations/tasks/string"{ "id": "string", "model": "string", "status": "queued", "content": { "video_url": "http://example.com", "last_frame_url": "http://example.com" }, "seed": 0, "resolution": "string", "ratio": "string", "duration": "string", "frames": 0, "framespersecond": 0, "generate_audio": true, "tools": { "type": "web_search" }, "safety_identifier": "string", "draft": true, "draft_task_id": "string", "service_tier": "string", "execution_expires_after": 0, "usage": { "completion_tokens": 0, "total_tokens": 0, "tool_usage": { "web_search": 0 } }, "error": { "code": "string", "message": "string" }, "created_at": 0, "updated_at": 0}授權
BearerAuth AuthorizationBearer <token>
API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。
位置: header
路徑參數
id*string
由建立端點回傳的相容性任務 ID。ID 以 cgt- 開頭。
回應
application/json
application/json
application/json
application/json
application/json
application/json