> ## 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 全能參考

> 此系列支援OpenAI影片生成格式（詳見連結 [影片生成Sora相容格式](/api-reference/zh-tw/%E5%BD%B1%E7%89%87%E7%94%9F%E6%88%90sora%E7%9B%B8%E5%AE%B9%E6%A0%BC%E5%BC%8F/%E5%BB%BA%E7%AB%8B%E5%BD%B1%E7%89%87)）。

Kling 4.0 原生任務介面。使用本站 Bearer API Key 驗證。請求主體無需 model；settings.resolution=720p 使用 kling-4.0，1080p 使用 kling-4.0-1080p，預設為 1080p。建立成功後，使用傳回的 data.id 呼叫 GET /tasks?task_ids=任務ID；多個 ID 以逗號分隔。查詢傳回的 data 為陣列，結果影片位於 data[].outputs[].url。

目前支援提示詞、first_frame、last_frame、refer_image、feature_video 對應的生成場景。不支援 middle_frame、base_video、element、voice、音訊參考、回呼或自訂外部任務 ID；非空的 options.callback_url、非空的 options.external_task_id、非空的 contents.id 及其他未支援欄位會返回 400。options 可省略或傳入空物件，也可傳入 watermark_info.enabled=false；暫不支援開啟浮水印。目前時長支援 4 至 30 秒，預設為 10 秒；暫不支援 3 秒。文生與參考場景的畫幅預設為 16:9，明確指定 adaptive 會返回 400。首尾幀場景不接受明確指定 settings.aspect_ratio，畫幅依首張 frame 圖片尺寸而定。

全能參考的 contents 必須包含非空的 prompt 與至少一個支援的媒體。歷史首尾幀場景可傳入 first_frame、last_frame 或兩者，但處理能力以目前可用的模型能力為準；能力不匹配時會拒絕處理，不會將幀圖靜默改為一般參考圖。首尾幀新接入建議使用圖生影片入口。首尾幀不能與 refer_image 參考圖或 feature_video 參考影片混用，混用會返回 400。參考場景可組合 refer_image 參考圖與 feature_video 參考影片。first_frame、last_frame、refer_image 各最多 1 項，feature_video 最多 5 項。暫不支援依賴 id 引用的多參考圖場景。



## OpenAPI

````yaml api-reference/zh-tw/openapi.json POST /omni-video/kling-4.0
openapi: 3.0.0
info:
  title: 出海營 API 參考文件
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.aiid.edu.kg
security:
  - BearerAuth: []
tags:
  - name: OpenAI格式（Chat）
  - name: OpenAI格式（Responses）
  - name: 圖片生成 Gemini 格式
  - name: 圖片生成OpenAI DALL-E 格式
  - name: 獲取模型列表
  - name: 影片生成HappyHorse與 Wan
  - name: 影片生成Kling格式
  - name: 影片生成 Omni 與 Veo 格式
  - name: 影片生成 Seedance 格式
  - name: 影片生成Sora相容格式
  - name: 影片生成 Vidu 格式
  - name: 音樂生成任務格式
paths:
  /omni-video/kling-4.0:
    post:
      tags:
        - 影片生成Kling格式
      summary: Kling 全能參考
      description: >-
        此系列支援OpenAI影片生成格式（詳見連結
        [影片生成Sora相容格式](/api-reference/zh-tw/%E5%BD%B1%E7%89%87%E7%94%9F%E6%88%90sora%E7%9B%B8%E5%AE%B9%E6%A0%BC%E5%BC%8F/%E5%BB%BA%E7%AB%8B%E5%BD%B1%E7%89%87)）。


        Kling 4.0 原生任務介面。使用本站 Bearer API Key 驗證。請求主體無需
        model；settings.resolution=720p 使用 kling-4.0，1080p 使用 kling-4.0-1080p，預設為
        1080p。建立成功後，使用傳回的 data.id 呼叫 GET /tasks?task_ids=任務ID；多個 ID 以逗號分隔。查詢傳回的
        data 為陣列，結果影片位於 data[].outputs[].url。


        目前支援提示詞、first_frame、last_frame、refer_image、feature_video 對應的生成場景。不支援
        middle_frame、base_video、element、voice、音訊參考、回呼或自訂外部任務 ID；非空的
        options.callback_url、非空的 options.external_task_id、非空的 contents.id
        及其他未支援欄位會返回 400。options 可省略或傳入空物件，也可傳入
        watermark_info.enabled=false；暫不支援開啟浮水印。目前時長支援 4 至 30 秒，預設為 10 秒；暫不支援 3
        秒。文生與參考場景的畫幅預設為 16:9，明確指定 adaptive 會返回 400。首尾幀場景不接受明確指定
        settings.aspect_ratio，畫幅依首張 frame 圖片尺寸而定。


        全能參考的 contents 必須包含非空的 prompt 與至少一個支援的媒體。歷史首尾幀場景可傳入
        first_frame、last_frame
        或兩者，但處理能力以目前可用的模型能力為準；能力不匹配時會拒絕處理，不會將幀圖靜默改為一般參考圖。首尾幀新接入建議使用圖生影片入口。首尾幀不能與
        refer_image 參考圖或 feature_video 參考影片混用，混用會返回 400。參考場景可組合 refer_image 參考圖與
        feature_video 參考影片。first_frame、last_frame、refer_image 各最多 1
        項，feature_video 最多 5 項。暫不支援依賴 id 引用的多參考圖場景。
      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: 可省略、傳入空物件或明確關閉浮水印。
                  properties:
                    watermark_info:
                      type: object
                      additionalProperties: false
                      required:
                        - enabled
                      properties:
                        enabled:
                          type: boolean
                          enum:
                            - false
                contents:
                  type: array
                  minItems: 2
                  description: >-
                    必須同時包含非空的 prompt 和支援的媒體；圖生影片必須包含
                    first_frame。first_frame/last_frame 不可與
                    refer_image/feature_video 混用，否則會傳回
                    400。各媒體的數量限制請參閱介面說明。歷史首尾幀請求會依目前可用的模型能力進行驗證；新的首尾幀接入建議使用圖生影片入口。
                  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: >-
                    歷史首尾影格相容場景：first_frame、last_frame 或兩者，受目前可用模型能力限制。不混用參考素材；省略
                    aspect_ratio，畫幅沿用首張 frame。
                  properties:
                    contents:
                      items:
                        properties:
                          type:
                            enum:
                              - prompt
                              - first_frame
                              - last_frame
                    settings:
                      not:
                        required:
                          - aspect_ratio
                - description: 參考場景：refer_image 和 feature_video 可搭配使用，畫面比例預設為 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: 成功
          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: 本站任務 ID，查詢時原樣傳入。
                      status:
                        type: string
                        enum:
                          - submitted
                          - processing
                          - succeeded
                          - failed
                      create_time:
                        type: integer
                        format: int64
                        description: 建立時間，Unix 毫秒。
                      update_time:
                        type: integer
                        format: int64
                        description: 更新時間，Unix 毫秒。
                      external_id:
                        type: string
                        maxLength: 0
              examples:
                success:
                  summary: 成功
                  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: 請求參數無效或包含不支援的欄位。
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        使用 Bearer Token 認證。
        格式: `Authorization: Bearer sk-xxxxxx`

````

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