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

# Créer une vidéo Kling Omni

> Utilisez CometAPI POST /kling/v1/videos/omni-video pour créer des tâches vidéo Kling O1 et suivre leur statut avec la route de requête Omni.

Utilisez ce point de terminaison pour le flux Kling Omni compatible O1 exposé par CometAPI, y compris la génération de texte en vidéo et la génération avec image de première frame comme référence.

<Note>
  Pour la référence complète des paramètres du fournisseur, consultez la [documentation Kling Omni Video](https://kling.ai/document-api/api/video/o1/video-omni).
</Note>

## Choisir le mode d'entrée

* Texte en vidéo : envoyez `prompt`, `mode`, `aspect_ratio` et `duration`
* Référence par image de première frame : ajoutez des éléments `image_list` avec `image_url` et `type: first_frame`, puis référencez l'image dans `prompt` sous la forme `<<<image_1>>>`
* Sortie avec filigrane : ajoutez `watermark_info.enabled: true` lorsque vous avez besoin d'une URL vidéo avec filigrane dans la réponse de requête
* Model ID : omettez `model_name` pour utiliser la valeur par défaut de la route, ou envoyez un model ID Omni Video testé tel que `kling-video-o1` ou `kling-v3-omni`

## Durée et ratio d'aspect

| Paramètre                                         | Valeurs prises en charge | Par défaut                    | Comportement aux limites                                                                                                                    |
| ------------------------------------------------- | ------------------------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `duration` pour une vidéo texte ou première frame | `"5"`, `"10"`            | `"5"`                         | Envoyez la valeur sous forme de chaîne et utilisez l'une des deux durées de génération fixes.                                               |
| `aspect_ratio`                                    | `16:9`, `9:16`, `1:1`    | `16:9`                        | Obligatoire lorsqu'aucune image de première frame ne contrôle le cadrage.                                                                   |
| `mode`                                            | `std`, `pro`             | valeur par défaut de la route | Envoyez `std` pour une génération standard ou `pro` uniquement lorsque le modèle sélectionné prend en charge ce mode de qualité supérieure. |

Kling Omni n'expose pas de champ `size` exact. Considérez `aspect_ratio` comme une demande de format d'image ; une requête texte en vidéo en `16:9` peut être rendue en full-HD `1920x1080`.

## Flux de tâche

<Steps>
  <Step title="Créer la tâche Omni">
    Soumettez la requête et stockez le `task_id` renvoyé.
  </Step>

  <Step title="Interroger la tâche Omni">
    Continuez avec [Obtenir une vidéo Kling Omni](./omni-query) jusqu'à ce que la tâche soit terminée.
  </Step>

  <Step title="Conserver la vidéo terminée">
    Déplacez l'URL MP4 renvoyée dans votre propre stockage si vous avez besoin d'un accès durable.
  </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.

````