> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dgrid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 동영상 조회

> 동영상 작업을 조회하고 생성 및 정산이 완료된 후 결과를 가져옵니다.

`TASK_ID`를 [동영상 생성 API](https://docs.dgrid.ai/ko/api-reference/videos/create-video.md)가 반환한 `id`로 설정하고 동일한 Model API Key를 사용하세요. 이 요청에는 본문이 필요하지 않습니다. `TASK_ID`에는 동영상 작업 ID를 입력하세요. 업로드 응답의 `asset_id`는 참고 자료의 검토 상태를 조회하는 데 사용합니다.

```bash theme={null}
TASK_ID='replace-with-returned-video-task-id'
curl -sS --fail-with-body --max-time 30 \
  "$DGRID_BASE_URL/videos/$TASK_ID" \
  --header "Authorization: Bearer $DGRID_API_KEY"
```

## 작업 및 정산 상태

| 결과 | 처리 방법 |
| - | - |
| `pending`, `preparing`, `submitting`, `queued`, `running` | 동일한 작업을 계속 조회하세요. |
| `billing_pending` 또는 아직 정산되지 않은 `succeeded` | 작업 ID를 유지하고 계속 조회하세요. |
| `settlement_status`가 `awaiting_balance` | 잔액을 충전한 후 동일한 작업을 다시 조회하세요. |
| `succeeded`이며 `settlement_status`가 `settled` | `video_url`, `billing.total`, 제공된 경우 `usage.video_tokens`를 읽으세요. |
| `failed`, `cancelled`, `expired` | 폴링을 중단하고 오류를 표시하세요. |
| `submission_unknown`, `configuration_blocked` 또는 알 수 없는 상태 | 작업 ID와 오류 세부 정보를 저장하고 대체 작업을 제출하기 전에 DGrid 지원팀에 문의하세요. |

오류와 확인이 필요한 상태를 우선 표시하세요. 처음에는 5초 간격으로 폴링하고 로컬 대기 시간 제한을 설정하세요. 로컬에서 폴링을 중단해도 나중에 같은 ID로 재개할 수 있습니다. 작업이 성공하고 정산이 완료된 상태에서 `video_url`이 누락되면 작업 ID와 함께 지원팀에 문의하세요.

## 정산 완료 응답 예제

아래 URL, 사용량, 금액은 예시입니다.

```json theme={null}
{
  "id": "11111111-1111-4111-8111-111111111111",
  "status": "succeeded",
  "settlement_status": "settled",
  "video_url": "https://example.invalid/generated-video.mp4",
  "usage": {
    "video_tokens": 123456
  },
  "billing": {
    "total": "1.32097920"
  }
}
```

| 필드 | 설명 |
| - | - |
| `id` | 동영상 작업 ID입니다. |
| `status` | 동영상 생성 상태입니다. |
| `settlement_status` | 정산 상태입니다. `status`와 함께 읽으세요. |
| `estimated_amount` | USD 기준 초기 예상 금액을 나타내는 십진수 문자열입니다. |
| `video_url` | 결과 URL입니다. 생성과 정산이 완료된 후 읽으세요. |
| `usage.video_tokens` | 제공된 경우 실제 동영상 토큰 사용량입니다. |
| `billing.total` | 최종 정산 금액(USD)입니다. |
| `error` | 제공된 경우 오류 세부 정보입니다. |

24시간 유효 기간은 서명된 참고 자료 업로드 URL에 적용됩니다.

## 비용 및 폴링 오류

DGrid는 작업을 접수할 때 예상 비용을 잔액에서 확보합니다. 최종 금액은 `billing.total`에서 확인하고, 요율은 DGrid의 현재 모델 가격을 참조하세요. 참고 동영상은 적용 요금 구간과 과금 대상 입력 길이에 영향을 줄 수 있습니다. 검토를 요청한 동영상의 입력 길이가 과금 대상이면 업로드 시 기록된 길이로 비용을 추산합니다. 동영상 토큰은 공급자가 보고한 실제 사용량으로 최종 정산합니다.

`404 video_task_not_found`가 반환되면 작업 UUID와 생성에 사용한 Model API Key를 확인하세요. `429`에서 `Retry-After`가 있으면 따르세요. 일시적인 `5xx` 또는 네트워크 시간 초과가 발생하면 대기 시간을 늘려 가며 같은 작업을 제한된 횟수만큼 다시 조회하세요.


## OpenAPI

````yaml api-reference/openapi.json GET /v1/videos/{id}
openapi: 3.1.0
info:
  title: DGrid AI Gateway API
  description: >-
    A single, unified API to access 200+ leading AI models. OpenAI-, Claude-,
    and Gemini-compatible endpoints for chat, completions, embeddings, images,
    video, audio, and moderations.
  version: 1.0.0
  contact:
    name: DGrid AI
    url: https://dgrid.ai
servers:
  - url: https://api.dgrid.ai
    description: DGrid AI Gateway
security:
  - bearerAuth: []
paths:
  /v1/videos/{id}:
    get:
      tags:
        - Videos
      summary: Retrieve video
      description: Retrieve the status and result of a video generation task.
      operationId: retrieveVideo
      parameters:
        - name: id
          in: path
          description: ID returned when creating the video task.
          required: true
          schema:
            type: string
            description: DGrid video task ID.
            format: uuid
      responses:
        '200':
          description: Current video task details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: DGrid video task ID.
                    format: uuid
                  model:
                    type: string
                    description: Model used for the task.
                  status:
                    type: string
                    description: Video task status.
                  settlement_status:
                    type: string
                    description: Billing settlement status.
                  estimated_amount:
                    type: string
                    description: Estimated cost in USD as a decimal string.
                  created_at:
                    type: string
                    description: Task creation timestamp.
                    format: date-time
                  video_url:
                    type: string
                    description: >-
                      Video URL. Read it after the task succeeds and settlement
                      completes.
                    format: uri
                  usage:
                    type: object
                    properties:
                      video_tokens:
                        type: integer
                        description: Actual video token usage when available.
                  billing:
                    type: object
                    properties:
                      total:
                        type: string
                        description: Final settled amount in USD.
                  error:
                    description: Error details when available.
                    oneOf:
                      - type: string
                      - type: object
              example:
                id: 11111111-1111-4111-8111-111111111111
                status: succeeded
                settlement_status: settled
                video_url: https://example.invalid/generated-video.mp4
                usage:
                  video_tokens: 123456
                billing:
                  total: '1.32097920'
        '404':
          description: Video task not found.
        '429':
          description: Rate limit exceeded.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your DGrid API key. All endpoints use `Authorization: Bearer
        <DGRID_API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.