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

# Kling All-in-One Reference

> This series supports OpenAI video generation formats (see the link [Video generation Sora compatible formats](/api-reference/en/video-generation-sora-compatible-format/create-video)).

Kling 4.0 native task API. Authenticate using this site's Bearer API Key. The request body does not require model; settings.resolution=720p uses kling-4.0, while 1080p uses kling-4.0-1080p, with 1080p as the default. After successful creation, use the returned data.id to call GET /tasks?task_ids=task ID; separate multiple IDs with commas. The returned data is an array, and the result video is available at data[].outputs[].url.

Currently supported generation scenarios include prompts, first_frame, last_frame, refer_image, and feature_video. middle_frame, base_video, element, voice, audio references, callbacks, and custom external task IDs are not supported. Non-empty options.callback_url, non-empty options.external_task_id, non-empty contents.id, and other unsupported fields will return 400. options can be omitted or passed as an empty object; watermark_info.enabled=false can also be passed. Enabling watermarks is not currently supported. Supported durations range from 4 to 30 seconds, with a default of 10 seconds; 3 seconds is not supported. For text-to-video and reference scenarios, the default aspect ratio is 16:9; explicitly specifying adaptive will return 400. For first- and last-frame scenarios, explicitly specifying settings.aspect_ratio is not accepted; the aspect ratio is determined by the dimensions of the first frame image.

For general-purpose reference, `contents` must include a non-empty `prompt` and at least one supported media item. For legacy first/last-frame scenarios, you can provide `first_frame`, `last_frame`, or both, but processing support depends on the capabilities of the currently available model. Requests with incompatible capabilities will be rejected; frame images will not be silently converted to regular reference images. For new first/last-frame integrations, we recommend using the image-to-video endpoint. First/last frames cannot be used together with `refer_image` reference images or `feature_video` reference videos; mixing them returns a 400 error. In reference scenarios, `refer_image` reference images and `feature_video` reference videos can be combined. `first_frame`, `last_frame`, and `refer_image` can each contain at most one item, while `feature_video` can contain up to five items. Multi-reference image scenarios that rely on ID references are not currently supported.



## OpenAPI

````yaml api-reference/en/openapi.json POST /omni-video/kling-4.0
openapi: 3.0.0
info:
  title: Overseas Expansion Camp API Reference Documentation
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.aiid.edu.kg
security:
  - BearerAuth: []
tags:
  - name: OpenAI format (Chat)
  - name: OpenAI Format (Responses)
  - name: Gemini Format for Image Generation
  - name: Image generationOpenAI DALL-E format
  - name: List models
  - name: Video generationHappyHorse and Wan
  - name: Video generation Kling format
  - name: Video generation Omni and Veo formats
  - name: Video generation Seedance
  - name: Video generation Sora compatible formats
  - name: Video generation Vidu
  - name: Music generation task format
paths:
  /omni-video/kling-4.0:
    post:
      tags:
        - Video generation Kling format
      summary: Kling All-in-One Reference
      description: >-
        This series supports OpenAI video generation formats (see the link
        [Video generation Sora compatible
        formats](/api-reference/en/video-generation-sora-compatible-format/create-video)).


        Kling 4.0 native task API. Authenticate using this site's Bearer API
        Key. The request body does not require model; settings.resolution=720p
        uses kling-4.0, while 1080p uses kling-4.0-1080p, with 1080p as the
        default. After successful creation, use the returned data.id to call GET
        /tasks?task_ids=task ID; separate multiple IDs with commas. The returned
        data is an array, and the result video is available at
        data[].outputs[].url.


        Currently supported generation scenarios include prompts, first_frame,
        last_frame, refer_image, and feature_video. middle_frame, base_video,
        element, voice, audio references, callbacks, and custom external task
        IDs are not supported. Non-empty options.callback_url, non-empty
        options.external_task_id, non-empty contents.id, and other unsupported
        fields will return 400. options can be omitted or passed as an empty
        object; watermark_info.enabled=false can also be passed. Enabling
        watermarks is not currently supported. Supported durations range from 4
        to 30 seconds, with a default of 10 seconds; 3 seconds is not supported.
        For text-to-video and reference scenarios, the default aspect ratio is
        16:9; explicitly specifying adaptive will return 400. For first- and
        last-frame scenarios, explicitly specifying settings.aspect_ratio is not
        accepted; the aspect ratio is determined by the dimensions of the first
        frame image.


        For general-purpose reference, `contents` must include a non-empty
        `prompt` and at least one supported media item. For legacy
        first/last-frame scenarios, you can provide `first_frame`, `last_frame`,
        or both, but processing support depends on the capabilities of the
        currently available model. Requests with incompatible capabilities will
        be rejected; frame images will not be silently converted to regular
        reference images. For new first/last-frame integrations, we recommend
        using the image-to-video endpoint. First/last frames cannot be used
        together with `refer_image` reference images or `feature_video`
        reference videos; mixing them returns a 400 error. In reference
        scenarios, `refer_image` reference images and `feature_video` reference
        videos can be combined. `first_frame`, `last_frame`, and `refer_image`
        can each contain at most one item, while `feature_video` can contain up
        to five items. Multi-reference image scenarios that rely on ID
        references are not currently supported.
      operationId: create_kling4_native_omni_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - contents
              properties:
                settings:
                  type: object
                  additionalProperties: false
                  properties:
                    resolution:
                      type: string
                      enum:
                        - 720p
                        - 1080p
                      default: 1080p
                    duration:
                      type: integer
                      minimum: 4
                      maximum: 30
                      default: 10
                    aspect_ratio:
                      type: string
                      enum:
                        - '21:9'
                        - '16:9'
                        - '9:16'
                        - '1:1'
                options:
                  type: object
                  additionalProperties: false
                  description: >-
                    You can omit it, pass an empty object, or explicitly disable
                    the watermark.
                  properties:
                    watermark_info:
                      type: object
                      additionalProperties: false
                      required:
                        - enabled
                      properties:
                        enabled:
                          type: boolean
                          enum:
                            - false
                contents:
                  type: array
                  minItems: 2
                  description: >-
                    A non-empty prompt and supported media must both be
                    provided. Image-to-video requests must include first_frame.
                    Do not use first_frame/last_frame together with
                    refer_image/feature_video; otherwise, a 400 error is
                    returned. See the API documentation for media quantity
                    limits. Legacy first-and-last-frame requests are validated
                    based on the capabilities of currently available models; for
                    new first-and-last-frame integrations, the image-to-video
                    endpoint is recommended.
                  items:
                    oneOf:
                      - type: object
                        additionalProperties: false
                        required:
                          - type
                          - text
                        properties:
                          type:
                            type: string
                            enum:
                              - prompt
                          text:
                            type: string
                            minLength: 1
                      - type: object
                        additionalProperties: false
                        required:
                          - type
                          - url
                        properties:
                          type:
                            type: string
                            enum:
                              - first_frame
                              - last_frame
                              - refer_image
                              - feature_video
                          url:
                            type: string
                            format: uri
                            pattern: ^https?://
                  not:
                    items:
                      properties:
                        type:
                          enum:
                            - prompt
              oneOf:
                - description: >-
                    Legacy first/last-frame compatibility scenarios:
                    `first_frame`, `last_frame`, or both, subject to the
                    capabilities of currently available models. Do not combine
                    with reference assets; omit `aspect_ratio`, and the aspect
                    ratio follows the first frame.
                  properties:
                    contents:
                      items:
                        properties:
                          type:
                            enum:
                              - prompt
                              - first_frame
                              - last_frame
                    settings:
                      not:
                        required:
                          - aspect_ratio
                - description: >-
                    Example scenario: `refer_image` and `feature_video` can be
                    used together. The default aspect ratio is 16:9.
                  properties:
                    contents:
                      items:
                        properties:
                          type:
                            enum:
                              - prompt
                              - refer_image
                              - feature_video
                    settings:
                      properties:
                        aspect_ratio:
                          type: string
                          enum:
                            - '21:9'
                            - '16:9'
                            - '9:16'
                            - '1:1'
                          default: '16:9'
            examples:
              kling4_native_720p:
                summary: Kling 720p
                value:
                  settings:
                    resolution: 720p
                    duration: 10
                    aspect_ratio: '16:9'
                  options: {}
                  contents:
                    - type: prompt
                      text: A cinematic product shot with natural motion
                    - type: refer_image
                      url: https://example.com/reference.jpg
                    - type: feature_video
                      url: https://example.com/motion.mp4
              kling4_native_1080p:
                summary: Kling 1080p
                value:
                  settings:
                    resolution: 1080p
                    duration: 10
                    aspect_ratio: '16:9'
                  options: {}
                  contents:
                    - type: prompt
                      text: A cinematic product shot with natural motion
                    - type: refer_image
                      url: https://example.com/reference.jpg
                    - type: feature_video
                      url: https://example.com/motion.mp4
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - request_id
                  - data
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                  request_id:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Task ID on this site. Pass it as-is when querying.
                      status:
                        type: string
                        enum:
                          - submitted
                          - processing
                          - succeeded
                          - failed
                      create_time:
                        type: integer
                        format: int64
                        description: Creation time, in Unix milliseconds.
                      update_time:
                        type: integer
                        format: int64
                        description: Update time, in Unix milliseconds.
                      external_id:
                        type: string
                        maxLength: 0
              examples:
                success:
                  summary: Success
                  value:
                    code: 0
                    message: SUCCEED
                    request_id: request_example
                    data:
                      id: task_example
                      status: submitted
                      create_time: 1792710000000
                      update_time: 1792710000000
                      external_id: ''
        '400':
          description: The request parameters are invalid or contain unsupported fields.
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        Use Bearer Token authentication.
        Format: `Authorization: Bearer sk-xxxxxx`

````

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