> ## 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/kling-4-0-omni.json post /v1/videos
openapi: 3.1.0
info:
  description: >-
    Kling 4.0 Omni: multimodal reference-to-video and video editing with up to
    10 images, 5 video clips and 3 audio clips as references.
  title: Kling 4.0 Omni
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Kling 4.0 Omni
paths:
  /v1/videos:
    post:
      tags:
        - Kling 4.0 Omni
      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:
              Reference images:
                description: >-
                  Send several reference images and say in the prompt what each
                  one is for.
                summary: Reference images
                value:
                  model: kling-4.0-omni
                  input:
                    prompt: >-
                      The girl from the first image and the fox from the second
                      image walk together through a snowy forest, cinematic
                    reference_image_urls:
                      - https://your-cdn.example.com/girl.png
                      - https://your-cdn.example.com/fox.png
                    resolution: 1080P
                    duration: 5
                    aspect_ratio: '16:9'
              Reference image and audio:
                description: >-
                  A reference image plus reference audio, with 21:9 ultra-wide
                  output.
                summary: Reference image and audio
                value:
                  model: kling-4.0-omni
                  input:
                    prompt: >-
                      The girl from the reference image speaks to the camera
                      with the voice of the reference audio, on a beach at dusk
                    reference_image_urls:
                      - https://your-cdn.example.com/girl.png
                    reference_audio_urls:
                      - https://your-cdn.example.com/voice.mp3
                    resolution: 720P
                    duration: 5
                    aspect_ratio: '21:9'
              Feature reference video:
                description: >-
                  `reference_video_type` set to `feature`: the video is a
                  feature reference for a new video. Requests with a reference
                  video are billed at the with-reference-video price.
                summary: Feature reference video
                value:
                  model: kling-4.0-omni
                  input:
                    prompt: >-
                      Follow the camera movement of the reference video to film
                      a red sports car driving along a desert road
                    reference_video_urls:
                      - https://your-cdn.example.com/reference.mp4
                    reference_video_type: feature
                    resolution: 720P
                    duration: 5
              Video editing:
                description: >-
                  `reference_video_type` set to `base`: the video is edited as
                  the prompt says; `keep_original_sound: true` keeps its sound.
                summary: Video editing
                value:
                  model: kling-4.0-omni
                  input:
                    prompt: >-
                      Change the season in the video from summer to a snowy
                      winter; keep the people and their motion unchanged
                    reference_video_urls:
                      - https://your-cdn.example.com/reference.mp4
                    reference_video_type: base
                    keep_original_sound: true
                    resolution: 720P
                    duration: 5
            schema:
              $ref: '#/components/schemas/Kling40OmniVideoRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    task_id: job_02b88886c4fda5be35baff61
                    status: in_progress
                    model: kling-4.0-omni
                    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:
    Kling40OmniVideoRequest:
      additionalProperties: false
      description: Body of a Kling 4.0 Omni video generation request.
      properties:
        model:
          description: |-
            Model name. Must be `kling-4.0-omni`.

            **Allowed values:**
            - `kling-4.0-omni`: Kling 4.0 Omni.
          enum:
            - kling-4.0-omni
          type: string
        input:
          $ref: '#/components/schemas/Kling40OmniVideoInput'
          description: >-
            Generation parameters. `prompt` is required; combine reference
            images, reference videos and reference audio as needed.
      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
    Kling40OmniVideoInput:
      additionalProperties: false
      description: Generation parameters of Kling 4.0 Omni.
      properties:
        prompt:
          description: >-
            The prompt (required): describes the video and says how each
            reference is used.
          type: string
        reference_image_urls:
          description: >-
            Public URLs of the reference images, up to 10. jpeg / jpg / png, up
            to 10MB each.
          items:
            type: string
          maxItems: 10
          type: array
        reference_video_urls:
          description: >-
            Public URLs of the reference videos, up to 5 clips. mp4 / mov, 3–30
            seconds each and 30 seconds in total. With a reference video the
            request is billed at the with-reference-video price; the billable
            duration is the reference video duration plus the output duration
            (when the reference video is longer than the output) or twice the
            output duration.
          items:
            type: string
          maxItems: 5
          type: array
        reference_video_type:
          description: >-
            How the reference video is used. Only applies when
            `reference_video_urls` is sent.


            **Allowed values:**

            - `feature`: Feature reference: a new video is generated with this
            video as a feature reference.

            - `base`: Video to edit: this video is edited as the prompt
            describes.
          enum:
            - feature
            - base
          type: string
        keep_original_sound:
          description: >-
            Whether to keep the original sound of the reference video. Only
            applies when `reference_video_urls` is sent.
          type: boolean
        reference_audio_urls:
          description: Public URLs of the reference audio clips, up to 3. mp3.
          items:
            type: string
          maxItems: 3
          type: array
        resolution:
          default: 720P
          description: |-
            Output resolution. Defaults to `720P`.

            **Allowed values:**
            - `720P`: 720P, native output.
            - `1080P`: 1080P, native output.
            - `2K`: 2K, upscaled output.
            - `4K`: 4K, upscaled output.
          enum:
            - 720P
            - 1080P
            - 2K
            - 4K
          type: string
        duration:
          default: 5
          description: >-
            Output duration in seconds, an integer from `3` to `30`. Defaults to
            `5`.
          format: int64
          maximum: 30
          minimum: 3
          type: integer
        aspect_ratio:
          description: |-
            Output aspect ratio.

            **Allowed values:**
            - `16:9`: Landscape.
            - `9:16`: Portrait.
            - `1:1`: Square.
            - `21:9`: Ultra-wide.
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
            - '21:9'
          type: string
      required:
        - prompt
      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.