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

# Create video

> Create an asynchronous video generation task and save the task ID for polling.

Use a production DGrid **Model API Key** with model access and enough available balance for the estimated cost. The following parameters describe Seedance 2.5. See the [video generation guide](https://docs.dgrid.ai/ai-gateway/video-generation.md) for credential setup and a complete walkthrough.

## Seedance 2.5 request parameters

| Parameter | Description |
| - | - |
| `model` | `bytedance/seedance-2.5`. |
| `content` | Text prompt and optional reference images or videos. |
| `duration` | Positive integer in seconds. The limit is 30 seconds per generation, subject to supported input combinations. |
| `resolution` | Output resolution. The example uses `720p`. Available settings depend on the model and channel. |
| `ratio` | Optional aspect ratio, such as `16:9`. |
| `generate_audio` | Optional boolean that controls audio generation. |
| `watermark` | Optional boolean that controls the watermark. |
| `seed` | Optional integer seed. |

Save this example as `request.json`.

```json theme={null}
{
  "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
}
```

Send the body as `application/json` with a Bearer token. Set a unique `Idempotency-Key` for each new logical task. Submitting the request may incur charges.

```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` means DGrid accepted the task and reserved the estimated cost. Save `id` to [query the task](https://docs.dgrid.ai/api-reference/videos/retrieve-video.md). This response uses illustrative values.

```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"
}
```

## Reference media

On the BytePlus Seedance channel, add media items to the `content` array alongside the text prompt. Use each upload's complete HTTPS URL, or provide a server-accessible HTTPS link. External reference videos must be direct MP4 links with readable duration and HTTP Range support.

```json theme={null}
{
  "model": "bytedance/seedance-2.5",
  "content": [
    {
      "type": "text",
      "text": "Use the scene in the reference image and the camera movement in the reference video to create a city street after the rain."
    },
    {
      "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"
}
```

After an asset submitted through DGrid by the same user reaches `Active`, you can use `asset://<IMAGE_ASSET_ID>` in `image_url.url` or `asset://<VIDEO_ASSET_ID>` in `video_url.url`. DGrid checks the official review status before reserving the estimated cost and again before submitting the generation request upstream. An `Active` asset can still be referenced after its signed upload link expires. Model input and content requirements still apply. See [Upload reference asset](https://docs.dgrid.ai/api-reference/videos/upload-reference-asset.md).

## Idempotency and errors

If a creation request times out or returns a temporary `503` before you receive a task ID, retry with the same API key, idempotency key, and request body. Any change to the body, including a signed URL, may cause a conflict. If acceptance is still uncertain, check or recover the original request before making a new one. If you already have the task ID, query that task.

Check the HTTP status first. Error details can appear as an `error` string or an `error.code` field. A gateway error can have a non-JSON body.

| HTTP status | Error or condition | What to do |
| - | - | - |
| `400` | `invalid_video_request` | Check the JSON, media items, duration, and resolution. |
| `401` | `unauthorized` | Check the production Model API Key and Bearer header. |
| `403` | `video_route_unavailable` | Check access to the model and channel. |
| `403` | `balance_insufficient` | The request was declined. Top up the balance and submit with a new idempotency key. |
| `409` | `idempotency_conflict` | Check which request body belongs to that key. |
| `409` | `video_asset_not_active` | Check review status. Wait for `Active` and investigate if it is `Failed`. |
| `422` | `video_asset_incompatible` | Check the asset type, owner, and channel. |
| `422` | `input_duration_unavailable` | Check that the video duration is readable and the external URL supports HTTP Range requests. |
| `429` | Rate limit | Honor `Retry-After` if present and retain the idempotency key. |
| `503` or timeout | Temporary or uncertain response | Retry the original request with the same credentials, idempotency key, and body. |


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