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

# Create a video task

> Submits an asynchronous video generation task and returns a `task_id` immediately; the video is generated in the background. The body is `{"model": "...", "input": {...}}` with every generation parameter inside `input`. Poll `GET /v1/videos/{task_id}` with the `task_id` until `status` is `completed` or `failed`.



## OpenAPI

````yaml /openapi/en/vidu-q4-preview.json post /v1/videos
openapi: 3.1.0
info:
  description: >-
    Vidu Q4 Preview: image-to-video from a first frame and reference-to-video
    (1–15 reference images, 0–3 reference audio clips), 3–16 seconds, 540P to
    4K, with synchronised audio.
  title: Vidu Q4 Preview
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Vidu Q4 Preview
paths:
  /v1/videos:
    post:
      tags:
        - Vidu Q4 Preview
      summary: Create a video task
      description: >-
        Submits an asynchronous video generation task and returns a `task_id`
        immediately; the video is generated in the background. The body is
        `{"model": "...", "input": {...}}` with every generation parameter
        inside `input`. Poll `GET /v1/videos/{task_id}` with the `task_id` until
        `status` is `completed` or `failed`.
      operationId: videoCreateTask
      requestBody:
        content:
          application/json:
            examples:
              Image-to-video (first frame):
                description: >-
                  `image_url` carries one first-frame image; the output follows
                  the image.
                summary: Image-to-video (first frame)
                value:
                  model: viduq4
                  input:
                    prompt: >-
                      The girl smiles and gently strokes the fox in a soft
                      breeze, cinematic
                    image_url: https://your-cdn.example.com/first-frame.png
                    resolution: 1080P
                    duration: 5
              Reference-to-video:
                description: >-
                  Send 1–15 reference images with a prompt; `aspect_ratio` sets
                  the frame.
                summary: Reference-to-video
                value:
                  model: viduq4
                  input:
                    prompt: >-
                      The girl and the fox sit by a campfire at night while the
                      camera cuts between them
                    reference_image_urls:
                      - https://your-cdn.example.com/girl.png
                      - https://your-cdn.example.com/fox.png
                    resolution: 720P
                    duration: 8
                    aspect_ratio: '9:16'
              Reference-to-video with audio:
                description: >-
                  Add 0–3 reference audio clips (mp3, 3–12 seconds each) to the
                  reference images.
                summary: Reference-to-video with audio
                value:
                  model: viduq4
                  input:
                    prompt: >-
                      The girl talks to the fox with the voice of the reference
                      audio and the fox tilts its head in reply
                    reference_image_urls:
                      - https://your-cdn.example.com/girl.png
                      - https://your-cdn.example.com/fox.png
                    reference_audio_urls:
                      - https://your-cdn.example.com/voice.mp3
                    resolution: 720P
                    duration: 5
                    aspect_ratio: '16:9'
              Silent video and options:
                description: >-
                  `generate_audio: false` produces a silent video;
                  `enhance_prompt` lets the model optimise the prompt; `seed`
                  fixes the random seed.
                summary: Silent video and options
                value:
                  model: viduq4
                  input:
                    prompt: The fox runs through the snow and the camera follows
                    image_url: https://your-cdn.example.com/first-frame.png
                    resolution: 540P
                    duration: 3
                    generate_audio: false
                    enhance_prompt: true
                    seed: 20261116
            schema:
              $ref: '#/components/schemas/ViduQ4VideoRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    task_id: job_02b88886c4fda5be35baff61
                    status: in_progress
                    model: viduq4
                    created_at: 1794846663
                    request_id: req_6a9a539502118ba1c33f1bfc
              schema:
                $ref: '#/components/schemas/VideoCreateTaskResponse'
          description: Task created.
          headers:
            X-Request-Id:
              description: ID of this request; include it when reporting issues.
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: invalid_request
                      http_status: 400
                      message: Invalid request.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: invalid_request_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: >-
            Invalid request: a required parameter is missing or a value is not
            allowed. A number or item count out of range is reported with the
            field and its allowed range; other cases return a generic message.
            No task is created and nothing is charged.
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: unauthorized
                      http_status: 401
                      message: Invalid API key.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: authentication_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: Missing or invalid API Key.
        '402':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: insufficient_balance
                      http_status: 402
                      message: Insufficient balance.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: insufficient_balance_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: >-
            Insufficient balance: the balance is below the estimated price of
            the request. No task is created.
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: rate_limit_exceeded
                      http_status: 429
                      message: Rate limit exceeded. Please try again later.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: rate_limit_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: Too many requests; retry later.
        '502':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: service_unavailable
                      http_status: 502
                      message: Service temporarily unavailable. Please try again later.
                      request_id: req_6a9a539502118ba1c33f1bfc
                      type: api_error
              schema:
                $ref: '#/components/schemas/VideoAPIErrorResponse'
          description: >-
            The model service is temporarily unavailable. No task is created and
            nothing is charged; retry later.
components:
  schemas:
    ViduQ4VideoRequest:
      additionalProperties: false
      description: Body of a Vidu Q4 Preview video generation request.
      properties:
        model:
          description: |-
            Model name. Must be `viduq4`.

            **Allowed values:**
            - `viduq4`: Vidu Q4 Preview.
          enum:
            - viduq4
          type: string
        input:
          $ref: '#/components/schemas/ViduQ4VideoInput'
          description: >-
            Generation parameters. `image_url` is image-to-video and
            `reference_image_urls` is reference-to-video; send exactly one of
            them. Text-to-video and first-and-last-frame are not supported.
      required:
        - model
        - input
      type: object
    VideoCreateTaskResponse:
      additionalProperties: false
      description: Response of a create request.
      properties:
        task_id:
          description: Task ID, used to query the task.
          type: string
        status:
          description: |-
            Task status; `queued` or `in_progress` right after creation.

            **Allowed values:**
            - `queued`: Waiting in the queue.
            - `in_progress`: Being generated.
            - `completed`: Finished; download the video from `video_url`.
            - `failed`: Failed; see `error` for the reason. Not charged.
          enum:
            - queued
            - in_progress
            - completed
            - failed
          type: string
        model:
          description: Model name.
          type: string
        created_at:
          description: Task creation time, Unix timestamp in seconds.
          format: int64
          type: integer
        request_id:
          description: ID of this request; include it when reporting issues.
          type: string
      required:
        - task_id
        - status
        - model
        - created_at
        - request_id
      type: object
    VideoAPIErrorResponse:
      additionalProperties: false
      description: Error response.
      properties:
        error:
          $ref: '#/components/schemas/VideoAPIError'
          description: Error details.
      required:
        - error
      type: object
    ViduQ4VideoInput:
      additionalProperties: false
      description: Generation parameters of Vidu Q4 Preview.
      properties:
        prompt:
          description: >-
            The prompt: describes the content, motion and camera work of the
            video. Required for reference-to-video.
          type: string
        image_url:
          description: >-
            Public URL of the first-frame image (exactly one); turns the request
            into image-to-video and cannot be combined with
            `reference_image_urls`. jpeg / jpg / png, up to 10MB.
          type: string
        reference_image_urls:
          description: >-
            Public URLs of the reference images, 1–15; turns the request into
            reference-to-video and cannot be combined with `image_url`. png /
            jpeg / jpg / webp.
          items:
            type: string
          maxItems: 15
          minItems: 1
          type: array
        reference_audio_urls:
          description: >-
            Public URLs of the reference audio clips, 0–3; only together with
            `reference_image_urls`. mp3, 3–12 seconds each.
          items:
            type: string
          maxItems: 3
          type: array
        resolution:
          default: 720P
          description: |-
            Output resolution. Defaults to `720P`.

            **Allowed values:**
            - `540P`: 540P.
            - `720P`: 720P.
            - `1080P`: 1080P.
            - `2K`: 2K.
            - `4K`: 4K.
          enum:
            - 540P
            - 720P
            - 1080P
            - 2K
            - 4K
          type: string
        duration:
          default: 5
          description: >-
            Output duration in seconds, an integer from `3` to `16`. Defaults to
            `5`.
          format: int64
          maximum: 16
          minimum: 3
          type: integer
        aspect_ratio:
          description: >-
            Output aspect ratio, for reference-to-video only. With a first-frame
            image the output follows the image.


            **Allowed values:**

            - `16:9`: Landscape.

            - `9:16`: Portrait.

            - `1:1`: Square.

            - `4:3`: Landscape 4:3.

            - `3:4`: Portrait 3:4.
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
          type: string
        generate_audio:
          description: >-
            Whether to generate synchronised audio with dialogue and sound
            effects. On by default; send `false` for a silent video.
          type: boolean
        enhance_prompt:
          description: Whether the model optimises the prompt automatically.
          type: boolean
        seed:
          description: Random seed, an integer; random when omitted.
          format: int64
          type: integer
      type: object
    VideoAPIError:
      additionalProperties: false
      description: Error details.
      properties:
        code:
          description: Error code.
          type: string
        http_status:
          description: HTTP status code.
          format: int64
          type: integer
        message:
          description: Human-readable error message.
          type: string
        request_id:
          description: Request ID; include it when reporting issues.
          type: string
        type:
          description: |-
            Error type.

            **Allowed values:**
            - `invalid_request_error`: Invalid request.
            - `authentication_error`: Authentication failed.
            - `insufficient_balance_error`: Insufficient balance.
            - `permission_error`: Permission denied.
            - `rate_limit_error`: Rate limited.
            - `api_error`: Server error.
          enum:
            - invalid_request_error
            - authentication_error
            - insufficient_balance_error
            - permission_error
            - rate_limit_error
            - api_error
          type: string
      required:
        - code
        - http_status
        - message
        - request_id
        - type
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        API Key created in the DreamTo console, sent as `Authorization: Bearer
        <API Key>`.
      scheme: bearer
      type: http

````

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