AGTCloud API Docs
가이드API 레퍼런스통합 및 리소스업데이트 및 도움말
비디오 생성플랫폼 Video Generations

비디오 조회

플랫폼 Video Generations API로 비디오 작업을 조회합니다.

생성 API가 반환한 작업 ID로 상태, 비디오 결과 및 메타데이터를 조회합니다. 작업이 succeeded 또는 failed 상태가 되면 폴링을 중지해야 합니다.

GET/v1/video/generations/{task_id}

생성 API가 반환한 Task ID로 비디오 작업의 현재 상태와 결과를 조회합니다. 작업이 succeeded 또는 failed 상태가 되면 폴링을 중지해야 합니다.

이 API는 플랫폼 Video Generations의 작업 경로와 상태 구조를 사용하며 OpenAI Videos의 Video ID 조회 API와 동일하지 않습니다.

인증

bearerAuth
인증Bearer <token>

Authorization Header에 Bearer your-api-key를 사용합니다.

전달 위치: header

경로 매개변수

task_id*string

플랫폼 비디오 작업 생성 시 반환하는 Task ID입니다.

길이1 <= length

응답 본문

application/json

application/json

application/json

application/json

application/json

application/json

작업 상태 폴링

비디오 생성은 비동기 과정입니다. 작업 제출 후 다음 간격으로 조회하여 결과 확인의 적시성과 요청 빈도를 조절할 수 있습니다:

  1. 작업 제출 후 먼저 2~3초 기다립니다.
  2. 처음 30초 동안은 5초마다 조회합니다.
  3. 30초부터 2분까지는 10초마다 조회합니다.
  4. 2분 이후에는 30초마다 조회합니다.
  5. 전체 시간 제한을 5~10분으로 설정하고 작업이 succeeded 또는 failed 상태가 되면 즉시 중지합니다.

JavaScript 폴링 예시

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(`HTTP ${response.status} 조회 실패`);
    }

    const result = await response.json();

    if (result.status === 'succeeded') {
      return result;
    }

    if (result.status === 'failed') {
      throw new Error(result.error?.message ?? '비디오 생성 실패');
    }

    const delay = attempt < 6 ? 5000 : attempt < 12 ? 10000 : 30000;
    await new Promise((resolve) => setTimeout(resolve, delay));
  }

  throw new Error('비디오 작업 폴링 시간 초과');
}

pollVideoStatus('TASK_ID').then(console.log).catch(console.error);