Interroga un task video Seedance tramite id su CometAPI con GET /v1/videos/. Funziona per i task Seedance 1.0 Pro, 1.5 Pro e 2.0. Restituisce lo stato corrente, l’avanzamento e il video_url firmato dopo che il task raggiunge SUCCESS.
curl https://api.cometapi.com/v1/videos/<TASK_ID> \
-H "Authorization: Bearer <COMETAPI_KEY>"{
"id": "task_abc123",
"model": "doubao-seedance-2-0-fast",
"object": "video",
"status": "IN_PROGRESS",
"progress": 45,
"created_at": 1776567610,
"completed_at": null
}id nel path è il valore restituito dalla chiamata di creazione, indipendentemente dal modello Seedance che ha generato il task.
SUBMITTED e IN_PROGRESS non sono terminali; SUCCESS, FAILED e ERROR sono terminali e il task non cambierà più stato.
| Status | Meaning | Terminal |
|---|---|---|
SUBMITTED | Accettato e messo in coda per il rendering. | no |
IN_PROGRESS | Rendering in corso. | no |
SUCCESS | Completato. video_url è presente nella risposta. | sì |
FAILED | Il provider ha rifiutato il task. | sì |
ERROR | Un errore interno ha impedito il completamento. | sì |
import time
import requests
TASK_ID = "<TASK_ID>"
headers = {"Authorization": "Bearer <COMETAPI_KEY>"}
TERMINAL = {"SUCCESS", "FAILED", "ERROR"}
while True:
response = requests.get(
f"https://api.cometapi.com/v1/videos/{TASK_ID}",
headers=headers,
timeout=15,
)
response.raise_for_status()
data = response.json()
if data["status"] in TERMINAL:
print(data.get("video_url"))
break
time.sleep(10)
status — determina la condizione di arresto del tuo ciclo di polling.progress — intero da 0 a 100 che puoi mostrare in un’interfaccia utente.video_url — URL di download firmato, presente solo in caso di SUCCESS. La firma ha una durata limitata nel tempo; scarica o ripubblica il file prima che scada.completed_at — timestamp Unix valorizzato quando il task raggiunge uno stato terminale.model — riporta il model id Seedance usato quando è stato creato il task.400 con message: "task_not_exist" significa che l’id è sconosciuto. Verifica di aver acquisito l’id da una risposta POST /v1/videos riuscita e di usarlo esattamente così com’è.401 significa che il bearer token manca o non è valido. Controlla che l’header della richiesta sia Authorization: Bearer <COMETAPI_KEY>.Bearer token authentication. Use your CometAPI key.
Task id returned by POST /v1/videos.
Current task state.
Task id.
Object type, always video.
Model id that generated the task.
Task status. SUBMITTED and IN_PROGRESS are non-terminal. SUCCESS, FAILED, and ERROR are terminal.
SUBMITTED, IN_PROGRESS, SUCCESS, FAILED, ERROR Completion percentage.
0 <= x <= 100Task creation time as a Unix timestamp in seconds.
Signed download URL for the finished video. Present only when status is SUCCESS. The signature is time-limited, so download or re-upload the file to your own storage soon after you receive it.
Task completion time as a Unix timestamp in seconds. null while the task is non-terminal.
curl https://api.cometapi.com/v1/videos/<TASK_ID> \
-H "Authorization: Bearer <COMETAPI_KEY>"{
"id": "task_abc123",
"model": "doubao-seedance-2-0-fast",
"object": "video",
"status": "IN_PROGRESS",
"progress": 45,
"created_at": 1776567610,
"completed_at": null
}