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

# Crear un video Kling Omni

> Usa CometAPI POST /kling/v1/videos/omni-video para crear tareas de video Kling O1 y hacer seguimiento del estado con la ruta de consulta Omni.

Usa este endpoint para el flujo de trabajo de Kling Omni compatible con O1 expuesto por CometAPI, incluyendo generación de texto a video y generación con referencia de imagen del primer fotograma.

<Note>
  Para la referencia completa de parámetros del proveedor, consulta la [documentación de Kling Omni Video](https://kling.ai/document-api/api/video/o1/video-omni).
</Note>

## Elige el modo de entrada

* Texto a video: envía `prompt`, `mode`, `aspect_ratio` y `duration`
* Referencia de imagen del primer fotograma: agrega elementos `image_list` con `image_url` y `type: first_frame`, luego haz referencia a la imagen en `prompt` como `<<<image_1>>>`
* Salida con marca de agua: agrega `watermark_info.enabled: true` cuando necesites una URL de video con marca de agua en la respuesta de consulta
* Model ID: omite `model_name` para usar el valor predeterminado de la ruta, o envía un model ID de Omni Video probado como `kling-video-o1` o `kling-v3-omni`

## Duración y relación de aspecto

| Configuración                                        | Valores admitidos     | Predeterminado            | Comportamiento en los límites                                                                                    |
| ---------------------------------------------------- | --------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `duration` para video de texto o de primer fotograma | `"5"`, `"10"`         | `"5"`                     | Envía el valor como una cadena y usa una de las dos duraciones de generación fijas.                              |
| `aspect_ratio`                                       | `16:9`, `9:16`, `1:1` | `16:9`                    | Obligatorio cuando ninguna imagen de primer fotograma controla el encuadre.                                      |
| `mode`                                               | `std`, `pro`          | predeterminado de la ruta | Envía `std` para generación estándar o `pro` solo cuando el modelo seleccionado admita el modo de mayor calidad. |

Kling Omni no expone un campo `size` exacto. Trata `aspect_ratio` como una solicitud de forma del fotograma; una solicitud de texto a video `16:9` puede renderizarse como full-HD `1920x1080`.

## Flujo de la tarea

<Steps>
  <Step title="Crear la tarea Omni">
    Envía la solicitud y guarda el `task_id` devuelto.
  </Step>

  <Step title="Consultar la tarea Omni">
    Continúa con [Obtener un video Kling Omni](./omni-query) hasta que la tarea finalice.
  </Step>

  <Step title="Persistir el video finalizado">
    Mueve la URL MP4 devuelta a tu propio almacenamiento si necesitas acceso duradero.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/kling/post-omni-video.openapi.json POST /kling/v1/videos/omni-video
openapi: 3.1.0
info:
  title: Omni Video API (Beta)
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/omni-video:
    post:
      summary: Omni Video (Beta)
      operationId: omni_video
      parameters:
        - name: Content-Type
          in: header
          required: false
          description: Content type of the request body.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - prompt
              properties:
                model_name:
                  type: string
                  description: >-
                    Optional model ID for this Kling Omni video request. Omit
                    this field to use the route default.
                prompt:
                  type: string
                  description: >-
                    Text prompt describing the desired video. Maximum length is
                    2,500 characters. When you send `image_list`, reference the
                    image with `<<<image_1>>>`.
                image_list:
                  type: array
                  description: >-
                    Optional first-frame image reference for image-referenced
                    Omni generation.
                  items:
                    type: object
                    required:
                      - image_url
                      - type
                    properties:
                      image_url:
                        type: string
                        description: Image URL or Base64 image string.
                      type:
                        type: string
                        description: >-
                          Reference role for this image. Use `first_frame` for
                          the first video frame.
                        enum:
                          - first_frame
                    additionalProperties: false
                sound:
                  type: string
                  description: Whether to generate audio with the video. Use `on` or `off`.
                  enum:
                    - 'on'
                    - 'off'
                  default: 'off'
                mode:
                  type: string
                  description: >-
                    Generation mode. Use `std` for standard generation or `pro`
                    when the selected model supports the higher-quality mode.
                  enum:
                    - std
                    - pro
                aspect_ratio:
                  type: string
                  description: >-
                    Aspect ratio request for beta Kling Omni generation. The
                    endpoint does not expose an exact size field; a 16:9
                    text-to-video request can render as 1920x1080.
                  enum:
                    - '16:9'
                    - '9:16'
                    - '1:1'
                duration:
                  type: string
                  description: >-
                    Requested output length for text-to-video and first-frame
                    image-reference workflows. Use `5` or `10` as a string.
                  default: '5'
                  enum:
                    - '5'
                    - '10'
                watermark_info:
                  type: object
                  description: >-
                    Watermark options. When `enabled` is `true`, the task can
                    return watermarked result URLs in addition to original
                    result URLs.
                  properties:
                    enabled:
                      type: boolean
                      description: Whether to request watermarked result URLs.
                  additionalProperties: false
                callback_url:
                  type: string
                  description: >-
                    Webhook URL for task status notifications. The server sends
                    a callback when the task status changes.
                  format: uri
                external_task_id:
                  type: string
                  description: >-
                    Optional user-defined task ID for your own tracking. Does
                    not replace the system-generated task ID. Must be unique per
                    account.
              default:
                model_name: kling-v3-omni
                prompt: A paper boat drifts across a calm pond at sunrise.
                mode: std
                aspect_ratio: '16:9'
                duration: '5'
                sound: 'off'
            examples:
              Text to video:
                summary: Kling Omni text-to-video request
                value:
                  model_name: kling-v3-omni
                  prompt: A paper boat drifts across a calm pond at sunrise.
                  mode: std
                  aspect_ratio: '16:9'
                  duration: '5'
                  sound: 'off'
              Image reference:
                summary: Kling Omni first-frame request
                value:
                  model_name: kling-video-o1
                  prompt: Animate <<<image_1>>> with a slow camera move.
                  image_list:
                    - image_url: https://your-image-host/first-frame.png
                      type: first_frame
                  mode: std
                  aspect_ratio: '16:9'
                  duration: '5'
                  sound: 'off'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: Response code. `0` means the task request was accepted.
                  message:
                    type: string
                    description: Response message.
                  request_id:
                    type: string
                    description: Request identifier returned by CometAPI when present.
                  data:
                    type: object
                    required:
                      - task_id
                      - task_status
                      - task_info
                      - created_at
                      - updated_at
                    properties:
                      task_id:
                        type: string
                        description: Task ID generated by the system.
                      task_status:
                        type: string
                        description: Task status.
                        enum:
                          - submitted
                          - processing
                          - succeed
                          - failed
                      task_info:
                        type: object
                        description: >-
                          Task metadata, including `external_task_id` when
                          supplied.
                        properties:
                          external_task_id:
                            type:
                              - string
                              - 'null'
                        additionalProperties: true
                      task_status_msg:
                        type:
                          - string
                          - 'null'
                        description: Status details when present.
                      created_at:
                        type: integer
                        description: >-
                          Task creation time as a Unix timestamp in
                          milliseconds.
                      updated_at:
                        type: integer
                        description: Task update time as a Unix timestamp in milliseconds.
                    additionalProperties: true
                additionalProperties: true
                example:
                  code: 0
                  message: SUCCEED
                  data:
                    task_id: <task_id>
                    task_status: submitted
                    task_info:
                      external_task_id: null
                    task_status_msg: null
                    created_at: 1773366840306
                    updated_at: 1773366840306
      x-codeSamples:
        - lang: Shell
          label: Text to video
          source: |
            curl https://api.cometapi.com/kling/v1/videos/omni-video \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "model_name": "kling-v3-omni",
                  "prompt": "A paper boat drifts across a calm pond at sunrise.",
                  "mode": "std",
                  "aspect_ratio": "16:9",
                  "duration": "5",
                  "sound": "off"
                }'
        - lang: Python
          label: Text to video
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/omni-video",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                  "model_name": "kling-v3-omni",
                  "prompt": "A paper boat drifts across a calm pond at sunrise.",
                  "mode": "std",
                  "aspect_ratio": "16:9",
                  "duration": "5",
                  "sound": "off"
                },
            )

            result = response.json()
            print(result.get("code"), result.get("data", {}).get("task_id"))
        - lang: JavaScript
          label: Text to video
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/videos/omni-video", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                "model_name": "kling-v3-omni",
                "prompt": "A paper boat drifts across a calm pond at sunrise.",
                "mode": "std",
                "aspect_ratio": "16:9",
                "duration": "5",
                "sound": "off"
              }),
            });


            const result = await response.json();

            console.log(result.code, result.data?.task_id);
        - lang: Shell
          label: Image reference
          source: |
            curl https://api.cometapi.com/kling/v1/videos/omni-video \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "model_name": "kling-video-o1",
                  "prompt": "Animate <<<image_1>>> with a slow camera move.",
                  "image_list": [
                    {
                      "image_url": "https://your-image-host/first-frame.png",
                      "type": "first_frame"
                    }
                  ],
                  "mode": "std",
                  "aspect_ratio": "16:9",
                  "duration": "5",
                  "sound": "off"
                }'
        - lang: Python
          label: Image reference
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/omni-video",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                  "model_name": "kling-video-o1",
                  "prompt": "Animate <<<image_1>>> with a slow camera move.",
                  "image_list": [
                    {
                      "image_url": "https://your-image-host/first-frame.png",
                      "type": "first_frame"
                    }
                  ],
                  "mode": "std",
                  "aspect_ratio": "16:9",
                  "duration": "5",
                  "sound": "off"
                },
            )

            result = response.json()
            print(result.get("code"), result.get("data", {}).get("task_id"))
        - lang: JavaScript
          label: Image reference
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/videos/omni-video", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                "model_name": "kling-video-o1",
                "prompt": "Animate <<<image_1>>> with a slow camera move.",
                "image_list": [
                  {
                    "image_url": "https://your-image-host/first-frame.png",
                    "type": "first_frame"
                  }
                ],
                "mode": "std",
                "aspect_ratio": "16:9",
                "duration": "5",
                "sound": "off"
              }),
            });


            const result = await response.json();

            console.log(result.code, result.data?.task_id);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````