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

# إنشاء فيديو Kling Omni

> استخدم CometAPI POST /kling/v1/videos/omni-video لإنشاء مهام فيديو Kling O1 وتتبع الحالة باستخدام مسار استعلام Omni.

استخدم نقطة النهاية هذه لسير عمل Kling Omni المتوافق مع O1 والمكشوف عبر CometAPI، بما في ذلك إنشاء الفيديو من النص وإنشاء الفيديو بالاستناد إلى صورة الإطار الأول.

<Note>
  للاطلاع على المرجع الكامل لمعاملات المزوّد، راجع [وثائق Kling Omni Video](https://kling.ai/document-api/api/video/o1/video-omni).
</Note>

## اختر وضع الإدخال

* من النص إلى فيديو: أرسل `prompt` و`mode` و`aspect_ratio` و`duration`
* مرجع صورة الإطار الأول: أضف عناصر `image_list` مع `image_url` و`type: first_frame`، ثم أشر إلى الصورة في `prompt` بصيغة `<<<image_1>>>`
* مخرجات بعلامة مائية: أضف `watermark_info.enabled: true` عندما تحتاج إلى عنوان URL لفيديو بعلامة مائية في استجابة الاستعلام
* model ID: احذف `model_name` لاستخدام القيمة الافتراضية للمسار، أو أرسل model ID مُختبَرًا لـ Omni Video مثل `kling-video-o1` أو `kling-v3-omni`

## المدة ونسبة العرض إلى الارتفاع

| الإعداد                                | القيم المدعومة        | الافتراضي                | سلوك الحدود                                                                           |
| -------------------------------------- | --------------------- | ------------------------ | ------------------------------------------------------------------------------------- |
| `duration` لفيديو النص أو الإطار الأول | `"5"`، `"10"`         | `"5"`                    | أرسل القيمة كسلسلة نصية واستخدم أحد طولي الإنشاء الثابتين.                            |
| `aspect_ratio`                         | `16:9`، `9:16`، `1:1` | `16:9`                   | مطلوب عندما لا تتحكم صورة الإطار الأول في الإطار.                                     |
| `mode`                                 | `std`، `pro`          | القيمة الافتراضية للمسار | أرسل `std` للإنشاء القياسي أو `pro` فقط عندما يدعم model ID المحدد وضع الجودة الأعلى. |

لا يوفّر Kling Omni حقل `size` دقيقًا. تعامل مع `aspect_ratio` على أنه طلب لشكل الإطار؛ إذ يمكن أن يُعرَض طلب تحويل النص إلى فيديو بنسبة `16:9` بدقة Full HD `1920x1080`.

## تدفق المهمة

<Steps>
  <Step title="إنشاء مهمة Omni">
    أرسل الطلب وخزّن `task_id` المُعاد.
  </Step>

  <Step title="استطلع مهمة Omni">
    تابع باستخدام [الحصول على فيديو Kling Omni](./omni-query) حتى تكتمل المهمة.
  </Step>

  <Step title="احفظ الفيديو المكتمل">
    انقل عنوان URL لملف MP4 المُعاد إلى مساحة التخزين الخاصة بك إذا كنت تحتاج إلى وصول دائم.
  </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.

````