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

# Kling 4.0 Flash

> 根据文本、起始帧或视觉参考快速生成 3–20 秒的 720p 视频，也可编辑已有视频。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.poyo.ai/zh/api-manual/task-management/status.md)接口获取结果。

Kling 4.0 Flash 是 [Kling 4.0](https://docs.poyo.ai/zh/api-manual/video-series/kling-4-0.md) 的快速 720p 版本，可根据文本创建视频、让起始帧动起来、组合视觉参考，或编辑已有视频。模式由提供的媒体自动选择。

## 模型

* **kling-4.0-flash** — `720p` 文生视频、图生视频、参考生视频和视频编辑

## 功能

* **快速 720p 输出**：生成 3–20 秒的 `720p` 视频。
* **起始帧**：让一张起始图片动起来。Flash 不支持结束帧。
* **视觉参考**：通过参考图片、参考视频以及由图片或视频定义的主体来引导外观和动作。
* **视频编辑**：提供源视频并描述要做的修改，编辑时还可以加入参考图片、参考视频和主体。不传 `duration` 即保留源视频时长。
* **宽高比**：文本模式和参考模式可使用 `16:9`、`9:16`、`1:1`、`21:9` 或 `auto`。

## 输入模式

| 模式 | 选择条件 |
| - | - |
| 视频编辑 | 提供了 `video_url` |
| 参考生视频 | 参考图片、参考视频或 `kling_elements` 非空 |
| 图生视频 | `image_urls` 非空且没有参考素材 |
| 文生视频 | 未提供任何媒体 |

在参考模式下，`image_urls` 可包含一个可选的起始帧。在图片模式下，`prompt` 可选；不要传 `aspect_ratio`，输出会沿用起始帧的宽高比。编辑模式不接受 `image_urls` 或 `aspect_ratio`，输出沿用源视频的宽高比。

## 必填参数

* `prompt` (string)：视频指令，1–26,000 个字符，至少包含一个非空白字符。除图生视频可选外，其余模式均必填。

## 可选参数

* `duration` (integer)：输出时长，3 到 20 秒。生成模式默认为 `5`。在编辑模式下，不传该字段即保留源视频时长；计费输出时长向上取整到整秒。
* `resolution` (string)：仅支持 `720p`。默认：`720p`。
* `aspect_ratio` (string)：`auto`、`16:9`、`9:16`、`1:1` 或 `21:9`，用于文本模式和参考模式。默认：`16:9`。文生视频中 `auto` 按 `16:9` 处理；参考模式中 `auto` 会适配所提供的素材。图片模式和编辑模式下不要传该字段。
* `image_urls` (array of strings)：一张起始图片。
* `video_url` (string)：用于编辑的源视频。时长必须为 3–20 秒。
* `reference_image_urls` (array of strings)：最多 10 个可公开访问的 HTTP 或 HTTPS 图片 URL。
* `reference_video_urls` (array of strings)：可公开访问的 HTTP 或 HTTPS 视频 URL，每个时长 3–20 秒。参考模式最多 5 个，编辑模式最多 4 个。
* `kling_elements` (array of objects)：最多 7 个主体。每个主体只能提供以下其中一项：
  * `element_input_urls` (array of strings)：2–4 张图片，正面视图在前，其他参考视图在后。
  * `element_input_video_urls` (array of strings)：恰好一个 3–8 秒的视频。最多 3 个主体可以使用视频。

主体按其在数组中的位置识别，无需命名。以 `@Element1`、`@Element2` 等引用它们。参考图片使用 `@Image1`、`@Image2` 等。参考模式下参考视频从 `@Video1` 开始；编辑模式下源视频为 `@Video1`，参考视频从 `@Video2` 开始。现有的 `@image_1` 和 `@video_1` 引用仍然支持。

## 示例

### 文生视频

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "callback_url": "https://your-domain.com/callback",
  "input": {
    "prompt": "A paper boat drifts through a miniature city at sunset, slow camera push-in",
    "duration": 5,
    "aspect_ratio": "16:9"
  }
}
```

### 图生视频

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "The red panda shakes the snow off its fur and turns toward the camera",
    "image_urls": ["https://example.com/start-frame.png"],
    "duration": 5
  }
}
```

### 参考图与主体

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "@Element1 walks along the cliff path toward the lighthouse in @Image1 at golden hour",
    "reference_image_urls": ["https://example.com/lighthouse.png"],
    "kling_elements": [
      {
        "element_input_urls": [
          "https://example.com/keeper-front.png",
          "https://example.com/keeper-side.png"
        ]
      }
    ],
    "duration": 8,
    "aspect_ratio": "9:16"
  }
}
```

### 参考视频

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "Follow the camera movement of @Video1 in the snowy mountain scene from @Image1",
    "reference_image_urls": ["https://example.com/mountain.png"],
    "reference_video_urls": ["https://example.com/camera-motion.mp4"],
    "duration": 8,
    "aspect_ratio": "16:9"
  }
}
```

### 视频编辑

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "Change the season in @Video1 to spring using @Image1, keeping the motion and camera",
    "video_url": "https://example.com/source.mp4",
    "reference_image_urls": ["https://example.com/spring.png"]
  }
}
```

## 注意事项

* 在参考模式下，可选的起始帧与参考图片合计不能超过 10 张。起始帧、参考图片、参考视频和主体的总数不能超过 15。主体内的图片计为一个主体，而不是单独的素材。
* 源视频、参考视频与基于视频的主体的原始时长合计最多 20 秒。每个源视频或参考视频时长必须为 3–20 秒，每个主体视频为 3–8 秒。
* Flash 不支持 `1080p`、结束帧和 `multi_prompt`，需要这些能力请使用 [Kling 4.0](https://docs.poyo.ai/zh/api-manual/video-series/kling-4-0.md)。
* 参考索引从 1 开始，按对应输入数组的顺序排列。请使用可公开访问的媒体 URL，并省略未使用的可选字段。


## OpenAPI

````yaml zh/api-manual/video-series/kling-4-0-flash.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Kling 4.0 Flash
  description: 根据文本、起始帧或视觉参考快速生成 720p 视频，并支持编辑已有视频。
  version: 1.0.0
servers:
  - url: https://api.poyo.ai
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      summary: 提交 Kling 4.0 Flash 视频任务
      operationId: submit_kling_4_0_flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              text-to-video:
                summary: 根据文本提示词生成视频
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: A paper boat floats through a miniature city at sunset.
              image-to-video:
                summary: 让起始图像动起来
                value:
                  model: kling-4.0-flash
                  input:
                    image_urls:
                      - https://example.com/start.png
                    prompt: The camera slowly pushes in as the lanterns flicker.
                    duration: 10
              reference-image:
                summary: 使用参考图像引导视频
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      The character in @Image1 walks along a sunlit forest
                      trail.
                    reference_image_urls:
                      - https://example.com/character.png
                    aspect_ratio: '9:16'
              reference-video:
                summary: 使用参考视频引导运动
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      Recreate the camera movement from @Video1 in a snowy
                      mountain landscape.
                    reference_video_urls:
                      - https://example.com/camera-motion.mp4
                    duration: 8
              image-subject:
                summary: 使用正面视图和参考视图引导主体
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: '@Element1 walks through the city square shown in @Image1.'
                    reference_image_urls:
                      - https://example.com/square.png
                    kling_elements:
                      - element_input_urls:
                          - https://example.com/character-front.png
                          - https://example.com/character-side.png
              video-edit:
                summary: 编辑视频并保留原始时长
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      Replace the background of @Video1 with a snowy mountain
                      landscape while keeping the camera movement.
                    video_url: https://example.com/source.mp4
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权：API Key 无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - kling-4.0-flash
          description: 公开的模型标识。
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook URL，用于接收任务完成或失败通知。
          example: https://your-domain.com/callback
        input:
          type: object
          additionalProperties: false
          description: >-
            提供 video_url 时选择视频编辑；提供参考图像、参考视频或主体时选择参考生成视频；仅提供 image_urls
            时选择图生视频；否则为文生视频。所有媒体 URL 必须是可公开访问的 HTTP 或 HTTPS URL。
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 26000
              description: >-
                视频指令，至少包含一个非空白字符。除图生视频可选外，其余模式均必填。按数组顺序以
                @Image1、@Video1、@Element1 引用参考图像、视频和主体。编辑模式下源视频为 @Video1，参考视频从
                @Video2 开始。原有的 @image_1 和 @video_1 写法仍然支持。
              example: >-
                A paper boat drifts through a miniature city at sunset, slow
                camera push-in
            duration:
              type: integer
              minimum: 3
              maximum: 20
              description: 输出时长，单位为整秒。生成模式默认 5 秒。编辑模式下省略此字段可保留源视频时长，计费输出时长向上取整到整秒。
              example: 5
            resolution:
              type: string
              enum:
                - 720p
              default: 720p
              description: 输出视频分辨率。Flash 仅支持 720p。
              example: 720p
            aspect_ratio:
              type: string
              enum:
                - auto
                - '16:9'
                - '9:16'
                - '1:1'
                - '21:9'
              default: '16:9'
              description: >-
                文生视频和参考模式的输出宽高比，默认 16:9。文生视频中 auto 按 16:9 处理；参考模式中 auto
                会根据所提供的素材自适应。图生视频和编辑模式下不要提供此字段，这两种模式分别沿用起始帧和源视频的宽高比。
              example: '16:9'
            reference_image_urls:
              type: array
              maxItems: 10
              items:
                type: string
                format: uri
              description: >-
                最多 10 张可公开访问的 HTTP 或 HTTPS 参考图像，以 @Image1、@Image2
                等引用。参考模式下，这些图像与可选的起始帧合计不能超过 10 张。支持参考模式和编辑模式。
              example:
                - https://example.com/reference-image.png
            reference_video_urls:
              type: array
              maxItems: 5
              x-video-duration-seconds:
                minimum: 3
                maximum: 20
              items:
                type: string
                format: uri
              description: >-
                可公开访问的 HTTP 或 HTTPS 参考视频，每个 3-20 秒。参考模式最多 5 个，以 @Video1、@Video2
                等引用；编辑模式最多 4 个，以 @Video2、@Video3 等引用。所有输入视频合计不能超过 20 秒。
              example:
                - https://example.com/reference-video.mp4
            image_urls:
              type: array
              maxItems: 1
              items:
                type: string
                format: uri
              description: >-
                一张可公开访问的 HTTP 或 HTTPS 起始帧。Flash 不支持结束帧。没有参考素材时选择图生视频。参考模式下起始帧计入
                10 张图像和 15 个素材的上限。编辑模式下不要提供此字段。
              minItems: 1
              example:
                - https://example.com/start-frame.png
            video_url:
              type: string
              format: uri
              x-video-duration-seconds:
                minimum: 3
                maximum: 20
              description: >-
                用于编辑的可公开访问的 HTTP 或 HTTPS 源视频，时长 3-20
                秒。提供后选择编辑模式。支持参考图像、参考视频和主体；不能与 image_urls 或 aspect_ratio 同时使用。
              example: https://example.com/source.mp4
            kling_elements:
              type: array
              maxItems: 7
              items:
                type: object
                additionalProperties: false
                minProperties: 1
                maxProperties: 1
                description: >-
                  element_input_urls 和 element_input_video_urls
                  必须且只能提供一个。主体按数组位置引用（如 @Element1），无需命名。
                properties:
                  element_input_urls:
                    type: array
                    maxItems: 4
                    items:
                      type: string
                      format: uri
                    description: 该主体的可公开访问的 HTTP 或 HTTPS 图像：第一张为正面视图，随后 1-3 张为其他角度的参考视图。
                    minItems: 2
                  element_input_video_urls:
                    type: array
                    maxItems: 1
                    x-video-duration-seconds:
                      minimum: 3
                      maximum: 8
                    items:
                      type: string
                      format: uri
                    description: 恰好一段可公开访问的 HTTP 或 HTTPS 主体视频，时长 3-8 秒。最多 3 个主体可以使用视频。
                    minItems: 1
              description: >-
                最多 7 个按位置引用的主体。在提示词中使用 @Element1、@Element2 等。最多 3
                个主体可以使用视频。支持参考模式和编辑模式。参考模式下，起始帧、参考图像、参考视频和主体合计不能超过 15
                个素材；一个主体内的图像算作一个主体。
              example:
                - element_input_urls:
                    - https://example.com/subject-front.png
                    - https://example.com/subject-side.png
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

            - `401`：API Key 缺失或无效

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

            - `500`：服务器内部错误

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1792741800-example
            status:
              type: string
              enum:
                - not_started
                - running
                - finished
                - failed
              example: not_started
              description: >-
                任务状态。提交后立即返回时始终为
                `not_started`。后续状态请通过[查询任务状态](/zh/api-manual/task-management/status)接口或
                `callback_url` 获取。


                - `not_started`：排队中，等待处理

                - `running`：生成中

                - `finished`：已完成，结果在 `files` 或 `output` 中

                - `failed`：失败，详情见 `error_message`
            created_time:
              type: string
              format: date-time
              example: '2026-10-23T10:30:00'
    ErrorResponse:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: integer
          example: 400
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

            - `401`：API Key 缺失或无效

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

            - `500`：服务器内部错误

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        所有 API 接口都需要 Bearer Token 认证。


        创建 API Key：登录 PoYo，进入 **仪表盘 → API
        密钥**（[poyo.ai/zh/dashboard/api-key](https://poyo.ai/zh/dashboard/api-key)），点击创建
        Key。


        在请求头中添加：


        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````

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