> ## 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.

# 동영상 생성 API

> 비동기 동영상 생성 작업을 만들고 폴링에 사용할 작업 ID를 저장합니다.

모델에 액세스할 수 있고 예상 비용을 충당할 잔액이 있는 운영 환경의 DGrid **Model API Key**를 사용하세요. 아래 매개변수는 Seedance 2.5에 적용됩니다. 인증 설정과 전체 절차는 [동영상 생성 가이드](https://docs.dgrid.ai/ko/ai-gateway/video-generation.md)를 참조하세요.

## Seedance 2.5 요청 매개변수

| 매개변수 | 설명 |
| - | - |
| `model` | `bytedance/seedance-2.5`. |
| `content` | 텍스트 프롬프트와 선택 사항인 참고 이미지 또는 동영상입니다. |
| `duration` | 초 단위의 양의 정수입니다. 한 번에 최대 30초까지 생성할 수 있으며, 지원되는 입력 조합을 사용해야 합니다. |
| `resolution` | 출력 해상도입니다. 예제에서는 `720p`를 사용하며, 지원 해상도는 모델과 채널에 따라 다릅니다. |
| `ratio` | 선택 사항인 가로세로 비율입니다. 예를 들어 `16:9`를 사용할 수 있습니다. |
| `generate_audio` | 오디오 생성 여부를 지정하는 선택적 불리언 값입니다. |
| `watermark` | 워터마크를 설정하는 선택적 불리언 값입니다. |
| `seed` | 선택적 정수 시드 값입니다. |

다음 예제를 `request.json`으로 저장하세요.

```json theme={null}
{
  "model": "bytedance/seedance-2.5",
  "content": [
    {
      "type": "text",
      "text": "새벽 해안에서 카메라가 천천히 앞으로 이동하고 파도가 바위에 부드럽게 부딪힙니다. 자연스럽고 안정적인 움직임을 유지합니다."
    }
  ],
  "duration": 5,
  "resolution": "720p",
  "ratio": "16:9",
  "generate_audio": false,
  "watermark": false
}
```

Bearer 토큰으로 인증하고 본문을 `application/json`으로 보내세요. 새 작업마다 고유한 `Idempotency-Key`를 설정하세요. 요청을 제출하면 비용이 발생할 수 있습니다.

```bash theme={null}
export DGRID_IDEMPOTENCY_KEY="$(uuidgen)"

curl -sS --fail-with-body --max-time 30 \
  "$DGRID_BASE_URL/videos" \
  --header "Authorization: Bearer $DGRID_API_KEY" \
  --header "Idempotency-Key: $DGRID_IDEMPOTENCY_KEY" \
  --header 'Content-Type: application/json' \
  --data-binary @request.json
```

HTTP `202`는 DGrid가 작업을 접수하고 예상 비용을 잔액에서 확보했음을 의미합니다. [작업을 조회](https://docs.dgrid.ai/ko/api-reference/videos/retrieve-video.md)할 때 사용할 `id`를 저장하세요. 아래 응답은 예시입니다.

```json theme={null}
{
  "id": "11111111-1111-4111-8111-111111111111",
  "model": "bytedance/seedance-2.5",
  "status": "pending",
  "settlement_status": "reserved",
  "estimated_amount": "1.15560000",
  "created_at": "2026-11-30T08:00:00Z"
}
```

## 참고 미디어

BytePlus Seedance 채널에서는 `content` 배열에 텍스트 프롬프트와 함께 미디어 항목을 추가할 수 있습니다. 업로드에서 받은 전체 HTTPS URL이나 서버에서 액세스할 수 있는 HTTPS 링크를 사용하세요. 외부 동영상에는 HTTP Range를 지원하며 재생 시간을 읽을 수 있는 MP4 직접 링크가 필요합니다.

```json theme={null}
{
  "model": "bytedance/seedance-2.5",
  "content": [
    {
      "type": "text",
      "text": "참고 이미지의 장면과 참고 동영상의 카메라 움직임을 바탕으로 비가 그친 도시의 거리를 만듭니다."
    },
    {
      "type": "image_url",
      "role": "reference_image",
      "image_url": {
        "url": "<IMAGE_UPLOAD_URL>"
      }
    },
    {
      "type": "video_url",
      "role": "reference_video",
      "video_url": {
        "url": "<VIDEO_UPLOAD_URL>"
      }
    }
  ],
  "duration": 5,
  "resolution": "720p",
  "ratio": "16:9"
}
```

동일한 사용자가 DGrid를 통해 검토를 요청한 자료가 `Active`가 되면 `image_url.url`에 `asset://<IMAGE_ASSET_ID>`를, `video_url.url`에 `asset://<VIDEO_ASSET_ID>`를 사용할 수 있습니다. DGrid는 예상 비용을 확보하기 전과 생성 요청을 공급자에게 제출하기 전에 공식 검토 상태를 확인합니다. 서명된 업로드 링크가 만료되어도 `Active` 상태이면 참조할 수 있습니다. 모델의 입력 및 콘텐츠 요구 사항은 계속 적용됩니다. [참고 자료 업로드](https://docs.dgrid.ai/ko/api-reference/videos/upload-reference-asset.md)를 참조하세요.

## 멱등성 및 오류

작업 ID를 받기 전에 생성 요청 시간이 초과되거나 일시적인 `503`이 발생하면 동일한 API Key, 멱등성 키, 요청 본문으로 다시 시도하세요. 서명된 URL 등 본문을 바꾸면 충돌이 발생할 수 있습니다. 접수 여부가 불확실하면 새 작업을 제출하기 전에 기존 요청을 확인하거나 복구하세요. 작업 ID가 있으면 해당 작업을 조회하세요.

HTTP 상태를 먼저 확인하세요. 오류 세부 정보는 `error` 문자열이나 `error.code` 필드에 표시될 수 있습니다. 게이트웨이 오류의 본문 형식은 JSON과 다를 수 있습니다.

| HTTP 상태 | 오류 또는 상황 | 처리 방법 |
| - | - | - |
| `400` | `invalid_video_request` | JSON, 미디어 항목, 재생 시간, 해상도를 확인하세요. |
| `401` | `unauthorized` | 운영 환경의 Model API Key와 Bearer 헤더를 확인하세요. |
| `403` | `video_route_unavailable` | 모델과 채널 액세스 권한을 확인하세요. |
| `403` | `balance_insufficient` | 요청이 거부되었습니다. 잔액을 충전하고 새 멱등성 키로 제출하세요. |
| `409` | `idempotency_conflict` | 키에 연결된 원본 요청 본문을 확인하세요. |
| `409` | `video_asset_not_active` | 검토 상태가 `Active`가 될 때까지 기다리세요. `Failed`이면 원인을 확인하세요. |
| `422` | `video_asset_incompatible` | 자료 유형, 소유자, 채널을 확인하세요. |
| `422` | `input_duration_unavailable` | 재생 시간을 읽을 수 있고 외부 URL이 HTTP Range를 지원하는지 확인하세요. |
| `429` | 속도 제한 | `Retry-After`가 있으면 따르고 멱등성 키를 유지하세요. |
| `503` 또는 시간 초과 | 일시적 오류 또는 접수 여부 불확실 | 동일한 인증 정보, 멱등성 키, 본문으로 원래 요청을 다시 시도하세요. |


## OpenAPI

````yaml api-reference/openapi.json POST /v1/videos
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:
    post:
      tags:
        - Videos
      summary: Create video
      description: >-
        Submit an asynchronous video generation task. This request may incur
        charges.
      operationId: createVideo
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Use a unique key for a new task. Reuse that key with the same
            request body if you retry.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - content
                - duration
                - resolution
              properties:
                model:
                  type: string
                  description: >-
                    Video model ID. The documented request format applies to
                    Seedance 2.5.
                  example: bytedance/seedance-2.5
                content:
                  type: array
                  description: Text prompt and optional reference media.
                  items:
                    oneOf:
                      - type: object
                        required:
                          - type
                          - text
                        properties:
                          type:
                            type: string
                            const: text
                          text:
                            type: string
                            description: Text prompt.
                      - type: object
                        required:
                          - type
                          - role
                          - image_url
                        properties:
                          type:
                            type: string
                            const: image_url
                          role:
                            type: string
                            const: reference_image
                          image_url:
                            type: object
                            required:
                              - url
                            properties:
                              url:
                                type: string
                                description: >-
                                  HTTPS URL or reviewed image asset URI on the
                                  BytePlus Seedance channel.
                      - type: object
                        required:
                          - type
                          - role
                          - video_url
                        properties:
                          type:
                            type: string
                            const: video_url
                          role:
                            type: string
                            const: reference_video
                          video_url:
                            type: object
                            required:
                              - url
                            properties:
                              url:
                                type: string
                                description: >-
                                  HTTPS URL or reviewed video asset URI on the
                                  BytePlus Seedance channel.
                duration:
                  type: integer
                  description: >-
                    Duration in seconds. The maximum depends on the supported
                    input combination.
                  minimum: 1
                  maximum: 30
                  example: 5
                resolution:
                  type: string
                  description: >-
                    Output resolution. Available settings depend on the model
                    and channel.
                  example: 720p
                ratio:
                  type: string
                  description: Output aspect ratio.
                  example: '16:9'
                generate_audio:
                  type: boolean
                  description: Whether to generate audio.
                watermark:
                  type: boolean
                  description: Whether to include a watermark.
                seed:
                  type: integer
                  description: Seed value.
            example:
              model: bytedance/seedance-2.5
              content:
                - type: text
                  text: >-
                    The camera slowly moves forward along the coast at dawn as
                    waves gently lap against the rocks. Keep the motion smooth
                    and natural.
              duration: 5
              resolution: 720p
              ratio: '16:9'
              generate_audio: false
              watermark: false
      responses:
        '202':
          description: Video task accepted.
          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
              example:
                id: 11111111-1111-4111-8111-111111111111
                model: bytedance/seedance-2.5
                status: pending
                settlement_status: reserved
                estimated_amount: '1.15560000'
                created_at: '2026-11-30T08:00:00Z'
        '400':
          description: Invalid video request.
        '401':
          description: Unauthorized.
        '403':
          description: Model route unavailable or insufficient balance.
        '409':
          description: Idempotency conflict or reference asset is not active.
        '422':
          description: Incompatible asset or unreadable input duration.
        '429':
          description: Rate limit exceeded.
        '503':
          description: Temporary service failure.
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.