Użyj GET /grok/v1/videos/, aby odpytywać o status generowania wideo xAI i pobrać końcowy URL wideo po zakończeniu przetwarzania.
curl --request GET \
--url https://api.cometapi.com/grok/v1/videos/{request_id} \
--header 'Authorization: Bearer <token>'{
"code": "success",
"message": "",
"data": {
"task_id": "4b2cd27e-0b0d-3dec-c31c-7572daf74bb3",
"action": "VIDEO_GENERATION",
"status": "SUCCESS",
"fail_reason": "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-72924fdc-e6d7-4885-b318-8a367aaa9a02.mp4",
"submit_time": 1773297002,
"start_time": 0,
"finish_time": 1773297014,
"progress": "100%",
"data": {
"model": "grok-imagine-video",
"usage": {
"cost_in_usd_ticks": 500000000
},
"video": {
"url": "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-72924fdc-e6d7-4885-b318-8a367aaa9a02.mp4",
"duration": 1,
"respect_moderation": true
},
"status": "done"
}
}
}request_id. Informuje on, czy zadanie xAI nadal jest wykonywane, i zwraca końcowe metadane wideo, gdy będą gotowe.
code i message pod kątem błędów najwyższego poziomudata.status dla stanu zadania CometAPIdata.data.status dla zagnieżdżonego stanu provideradata.data.video.url, gdy renderowanie zostanie zakończoneNajpierw utwórz lub edytuj wideo
request_id.Kontynuuj odpytywanie, aż zagnieżdżony status będzie done
Bearer token authentication. Use your CometAPI key.
Deferred request id returned by the create or edit endpoint.
curl --request GET \
--url https://api.cometapi.com/grok/v1/videos/{request_id} \
--header 'Authorization: Bearer <token>'{
"code": "success",
"message": "",
"data": {
"task_id": "4b2cd27e-0b0d-3dec-c31c-7572daf74bb3",
"action": "VIDEO_GENERATION",
"status": "SUCCESS",
"fail_reason": "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-72924fdc-e6d7-4885-b318-8a367aaa9a02.mp4",
"submit_time": 1773297002,
"start_time": 0,
"finish_time": 1773297014,
"progress": "100%",
"data": {
"model": "grok-imagine-video",
"usage": {
"cost_in_usd_ticks": 500000000
},
"video": {
"url": "https://vidgen.x.ai/xai-vidgen-bucket/xai-video-72924fdc-e6d7-4885-b318-8a367aaa9a02.mp4",
"duration": 1,
"respect_moderation": true
},
"status": "done"
}
}
}