Retrieve a video
Retrieve a video task with the platform Video Generations API.
Use the task ID returned by the create endpoint to retrieve status, video output, and metadata. Stop polling when the task reaches succeeded or failed.
/v1/video/generations/{task_id}Use the Task ID returned by the creation interface to query the current status and result of video tasks. Polling should stop once a task enters succeeded or failed.
This interface uses the task path and status structure of the Video Generations platform and is not equivalent to the Video ID query interface of OpenAI Videos
Authorization
bearerAuth Use Bearer your-api-key in the Authorization Header.
In: header
Path Parameters
The Task ID returned when creating platform video tasks.
1 <= lengthResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
Poll task status
Video generation is asynchronous. After submitting a task, use the following polling intervals to balance result latency and request frequency:
- Wait 2–3 seconds after submitting the task.
- Poll every 5 seconds during the first 30 seconds.
- Poll every 10 seconds from 30 seconds to 2 minutes.
- Poll every 30 seconds after 2 minutes.
- Set an overall timeout of 5–10 minutes and stop immediately when the task reaches
succeededorfailed.
JavaScript polling example
async function pollVideoStatus(taskId, maxAttempts = 30) {
const apiOrigin = 'https://api.agtcloud.cn';
const headers = {
Authorization: 'Bearer your-api-key',
};
await new Promise((resolve) => setTimeout(resolve, 3000));
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
const response = await fetch(
`${apiOrigin}/v1/video/generations/${encodeURIComponent(taskId)}`,
{ headers },
);
if (!response.ok) {
throw new Error(`Query failed with HTTP ${response.status}`);
}
const result = await response.json();
if (result.status === 'succeeded') {
return result;
}
if (result.status === 'failed') {
throw new Error(result.error?.message ?? 'Video generation failed');
}
const delay = attempt < 6 ? 5000 : attempt < 12 ? 10000 : 30000;
await new Promise((resolve) => setTimeout(resolve, delay));
}
throw new Error('Video task polling timed out');
}
pollVideoStatus('TASK_ID').then(console.log).catch(console.error);