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

# 创建视频

> 创建 Kling 视频任务。

**路径：** `POST https://api.omniall.ai/v1/videos`

文生 / 图生判定：存在 `image` / `images` / `input_reference` / `metadata.last_frame_*` / 参考视频等 → 图生；否则 → 文生。

鉴权：`Authorization: Bearer sk-...`



## OpenAPI

````yaml zh-CN/openapi/kling-video.yaml POST /v1/videos
openapi: 3.1.0
info:
  title: Omniall AI — 快手可灵
  version: 1.0.0
  description: >-
    通过 OpenAI Video 风格协议调用 Kling 视频能力。


    **创建：** `POST https://api.omniall.ai/v1/videos`


    **查询：** `GET /v1/videos/{task_id}` · **下载：** `GET
    /v1/videos/{task_id}/content`


    模型别名（大小写不敏感）。见[模型广场](https://omniall.ai/pricing)。


    **时长优先级：** 顶层 `seconds` > 顶层 `duration` > `metadata.seconds` /
    `metadata.duration` / `metadata.video_duration` > 默认 **5**。


    **分辨率优先级：** `metadata.output_config.resolution` > `metadata.resolution` > 顶层
    `size` > 默认 **720P**。


    鉴权：`Authorization: Bearer sk-...`
servers:
  - url: https://api.omniall.ai
security: []
paths:
  /v1/videos:
    post:
      tags:
        - Kling
      summary: 创建视频
      description: >-
        创建 Kling 视频任务。


        **路径：** `POST https://api.omniall.ai/v1/videos`


        文生 / 图生判定：存在 `image` / `images` / `input_reference` /
        `metadata.last_frame_*` / 参考视频等 → 图生；否则 → 文生。


        鉴权：`Authorization: Bearer sk-...`
      operationId: klingCreateVideo
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
            example: Bearer sk-...
          description: Bearer API Key，例如 `Bearer sk-...`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KlingCreateRequest'
            examples:
              文生视频（720P）:
                summary: 文生视频（720P）
                value:
                  model: kling-2.6
                  prompt: 赛博朋克城市夜景，镜头慢慢推进
                  seconds: '5'
                  metadata:
                    output_config:
                      resolution: 720P
                      aspect_ratio: '16:9'
              文生视频 1080P（无声）:
                summary: 文生视频 1080P（无声）
                value:
                  model: kling-3.0
                  prompt: 雪山之巅，雄鹰盘旋
                  seconds: '10'
                  metadata:
                    output_config:
                      duration: 10
                      resolution: 1080P
                      aspect_ratio: '16:9'
                      audio_generation: Disabled
              有声视频:
                summary: 有声视频
                value:
                  model: kling-2.5
                  prompt: 街头乐队演奏爵士乐，人群围观
                  seconds: '10'
                  metadata:
                    output_config:
                      duration: 10
                      resolution: 1080P
                      aspect_ratio: '16:9'
                      audio_generation: Enabled
              单图生视频:
                summary: 单图生视频
                value:
                  model: Kling-2.5
                  prompt: 让人物向前走并微笑，自然光
                  image: https://example.com/character.png
                  seconds: '5'
                  metadata:
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '9:16'
                      audio_generation: Disabled
              多图生视频:
                summary: 多图生视频
                value:
                  model: Kling-3.0-Omni
                  prompt: 图1是角色陈舟，图2是场景虚无幽暗系统空间，镜头从远到近
                  images:
                    - https://example.com/role.png
                    - https://example.com/scene.png
                  seconds: '15'
                  metadata:
                    output_config:
                      duration: 15
                      resolution: 1080P
                      aspect_ratio: '9:16'
              竖屏 size 写法:
                summary: 竖屏 size 写法
                value:
                  model: kling-3.0-omni
                  prompt: 角色在蓝色面板前缓慢转身
                  seconds: '15'
                  size: 720x1280
                  metadata:
                    output_config:
                      duration: 15
                      resolution: 720P
                      aspect_ratio: '9:16'
                      audio_generation: Enabled
              首尾帧:
                summary: 首尾帧
                value:
                  model: Kling-3.0
                  prompt: 从第一帧平滑过渡到最后一帧
                  image: https://example.com/first.png
                  seconds: '8'
                  metadata:
                    last_frame_url: https://example.com/last.png
                    output_config:
                      duration: 8
                      resolution: 1080P
                      aspect_ratio: '16:9'
                      audio_generation: Enabled
              动作控制 std:
                summary: 动作控制 std
                value:
                  model: Kling-2.6
                  prompt: 人物按参考视频动作运动
                  seconds: '5'
                  metadata:
                    scene_type: motion_control
                    motion_level: std
                    video_url: https://example.com/motion-ref.mp4
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '16:9'
              动作控制 pro:
                summary: 动作控制 pro
                value:
                  model: Kling-2.6
                  prompt: 舞者复刻参考视频中的高难度动作
                  seconds: '10'
                  metadata:
                    scene_type: motion_control
                    motion_level: pro
                    video_url: https://example.com/dance-ref.mp4
                    output_config:
                      duration: 10
                      resolution: 1080P
                      aspect_ratio: '16:9'
              数字人:
                summary: 数字人
                value:
                  model: kling-avatar-1080p
                  prompt: 数字人播报今日新闻，表情自然
                  image: https://example.com/avatar-face.png
                  seconds: '5'
                  metadata:
                    scene_type: avatar_i2v
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '9:16'
              对口型:
                summary: 对口型
                value:
                  model: kling-identify-face
                  prompt: 人物口型与音频同步
                  image: https://example.com/face.png
                  seconds: '4'
                  metadata:
                    scene_type: lip_sync
                    output_config:
                      duration: 4
              参考视频（file_infos）:
                summary: 参考视频（file_infos）
                value:
                  model: Kling-3.0-Omni
                  prompt: 基于参考视频生成同风格镜头
                  seconds: '5'
                  metadata:
                    file_infos:
                      - type: Url
                        category: Video
                        url: https://example.com/ref-video.mp4
                        reference_type: feature
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '16:9'
                      audio_generation: Disabled
              动作控制 + file_infos:
                summary: 动作控制 + file_infos
                value:
                  model: Kling-3.0-Omni
                  prompt: 让人物按参考视频动作运动
                  seconds: '5'
                  metadata:
                    scene_type: motion_control
                    motion_level: pro
                    file_infos:
                      - type: Url
                        category: Video
                        url: https://example.com/motion-ref.mp4
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '16:9'
              ExtInfo 多镜头:
                summary: ExtInfo 多镜头
                value:
                  model: Kling-3.0
                  seconds: '5'
                  metadata:
                    file_infos:
                      - type: Url
                        category: Image
                        url: https://example.com/ref-image.png
                    output_config:
                      duration: 5
                      resolution: 720P
                      aspect_ratio: '16:9'
                      input_compliance_check: Disabled
                    ext_info: >-
                      {"AdditionalParameters":"{\"multi_prompt\":[{\"index\":1,\"prompt\":\"美女在跳舞\",\"duration\":\"2\"},{\"index\":2,\"prompt\":\"美女跳起来\",\"duration\":\"3\"}],\"shot_type\":\"customize\",\"multi_shot\":true}"}
              content 数组写法:
                summary: content 数组写法
                value:
                  model: kling-3.0-omni
                  seconds: '10'
                  content:
                    - type: text
                      text: 角色在系统面板前缓慢转身
                  images:
                    - https://example.com/ref.png
                  metadata:
                    output_config:
                      duration: 10
                      resolution: 720P
                      aspect_ratio: '9:16'
                      audio_generation: Enabled
      responses:
        '200':
          description: 任务已受理
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KlingTask'
              example:
                id: task_xxxxxxxx
                task_id: task_xxxxxxxx
                object: video
                model: kling-2.5-720p
                status: queued
                progress: 0
                created_at: 1780891541
components:
  schemas:
    KlingCreateRequest:
      type: object
      required:
        - model
      description: Kling 创建视频请求体。
      properties:
        model:
          type: string
          description: >-
            模型别名（大小写不敏感）。生成：`kling-1.0` … `kling-3.0-omni`、`kling-o1`。专用：
            `kling-identify-face`、`kling-avatar-720p`、`kling-avatar-1080p`。
          example: kling-2.5
        prompt:
          type: string
          description: 文本提示词（多数场景必填）。
        seconds:
          type: string
          description: 视频时长（秒）字符串，如 `"5"`、`"10"`。时长优先级最高。
          example: '5'
        duration:
          oneOf:
            - type: number
            - type: string
          description: 时长（秒）；与顶层 `seconds` 同时存在时 `seconds` 优先。
        size:
          type: string
          description: 尺寸快捷写法，如 `720x1280`、`720P`、`1080P`，可隐含分辨率与宽高比。
          example: 720x1280
        image:
          type: string
          description: 单张参考图 URL。
        images:
          type: array
          items:
            type: string
          description: 多张参考图 URL（最多 3 张）。Omni 有参考计费请优先用 `images`。
          maxItems: 3
        input_reference:
          type: string
          description: 参考图 URL（类似 `image`）。
        mode:
          type: string
          description: 动作控制时可传 `pro` 表示 Pro 档位。
          example: pro
        content:
          type: array
          description: OpenAI 风格多模态内容；网关从 `type=text` 提取文本。
          items:
            type: object
            properties:
              type:
                type: string
                description: text / image_url / video_url …
              text:
                type: string
              image_url:
                type: object
                properties:
                  url:
                    type: string
        metadata:
          $ref: '#/components/schemas/KlingMetadata'
    KlingTask:
      type: object
      properties:
        id:
          type: string
        task_id:
          type: string
        object:
          type: string
          example: video
        model:
          type: string
          description: 实际计费档位名称。
        status:
          type: string
          description: >-
            queued / pending / processing / in_progress / completed / failed /
            cancelled
        progress:
          type: integer
        created_at:
          type: integer
        completed_at:
          type: integer
        seconds:
          type: string
        size:
          type: string
        video_url:
          type: string
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
    KlingMetadata:
      type: object
      description: Kling 扩展参数。
      properties:
        scene_type:
          type: string
          enum:
            - motion_control
            - avatar_i2v
            - lip_sync
          description: 场景类型。普通文生/图生可不传。`motion_control` 必须提供公网可访问参考视频。
        motion_level:
          type: string
          enum:
            - std
            - pro
          description: '动作控制档位（默认 `std`）。也可用 `mode: "pro"`。'
        video_url:
          type: string
          description: 参考视频 URL（动作控制必填；Omni 参考也可使用）。
        last_frame_url:
          type: string
          description: 尾帧图片 URL（首尾帧）。
        last_frame_file_id:
          type: string
          description: 尾帧文件 ID。
        file_infos:
          type: array
          maxItems: 3
          description: 结构化文件输入（最多 3 项）。
          items:
            $ref: '#/components/schemas/KlingFileInfo'
        ext_info:
          type: string
          description: 高级扩展 JSON **字符串**（不能传 object），如 kling-3.0 / omni 多镜头。
        output_config:
          $ref: '#/components/schemas/KlingOutputConfig'
        resolution:
          type: string
          description: 分辨率快捷字段（等价于 `output_config.resolution`）。
        audio_generation:
          type: string
          enum:
            - Enabled
            - Disabled
          description: 有声快捷字段（等价于 `output_config.audio_generation`）。
        audio:
          type: boolean
          description: '`true` 表示开启有声。'
        seconds:
          type: string
        duration:
          oneOf:
            - type: number
            - type: string
        video_duration:
          oneOf:
            - type: number
            - type: string
        mode:
          type: string
    KlingFileInfo:
      type: object
      properties:
        type:
          type: string
          enum:
            - File
            - Url
          description: '`Url` 必须带 `url`；`File` 必须带 `file_id`。'
        category:
          type: string
          enum:
            - Image
            - Video
        url:
          type: string
        file_id:
          type: string
        usage:
          type: string
          description: 如 FirstFrame / Reference。
        reference_type:
          type: string
          enum:
            - feature
            - base
          description: 视频参考类型。
    KlingOutputConfig:
      type: object
      properties:
        duration:
          type: number
          description: 输出时长（秒），建议与顶层 `seconds` 一致。
          example: 5
        resolution:
          type: string
          enum:
            - 720P
            - 1080P
          description: 默认 720P。
        aspect_ratio:
          type: string
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
          description: 文生默认 16:9。
        audio_generation:
          type: string
          enum:
            - Enabled
            - Disabled
          description: 默认 Disabled（无声）。
        storage_mode:
          type: string
          enum:
            - Permanent
            - Temporary
        media_name:
          type: string
          maxLength: 64
        class_id:
          type: integer
        expire_time:
          type: string
          description: ISO 8601.
        person_generation:
          type: string
          enum:
            - AllowAdult
            - Disallowed
        input_compliance_check:
          type: string
          enum:
            - Enabled
            - Disabled
        output_compliance_check:
          type: string
          enum:
            - Enabled
            - Disabled
        enhance_switch:
          type: string
          enum:
            - Enabled
            - Disabled

````

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