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

# Kling 4.0 Flash 视频编辑

> Kling 4.0 Flash 视频编辑 API 按提示词编辑 3–20 秒的源视频，可加参考图、参考视频和主体引导，输出 720p。

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

Kling 4.0 Flash 视频编辑根据文字指令改写 3–20 秒的源视频，同时保留原有的动作和节奏。可添加参考图、参考视频或主体，把特定角色、服装或风格带入编辑结果。

Kling 4.0 Flash 是快手 Kling 4.0 视频模型中速度更快的 720p 版本。Vidgo 提供四个模型 ID：[文生视频](https://docs.vidgo.ai/zh/api-manual/video-series/kwaivgi-kling-v4-0-flash-text-to-video.md)、[图生视频](https://docs.vidgo.ai/zh/api-manual/video-series/kwaivgi-kling-v4-0-flash-image-to-video.md)、[参考生视频](https://docs.vidgo.ai/zh/api-manual/video-series/kwaivgi-kling-v4-0-flash-reference-to-video.md)和[视频编辑](https://docs.vidgo.ai/zh/api-manual/video-series/kwaivgi-kling-v4-0-flash-video-edit.md)。

## 模型

* **kwaivgi/kling-v4.0-flash/video-edit** — Kling 4.0 Flash 视频编辑，一个 3–20 秒源视频，输出 720p。

## 功能

* 编辑 `video_url` 中 3–20 秒的源视频。
* 可选引导素材：最多 10 张参考图、4 个参考视频和 7 个主体。
* 输出时长默认跟随源视频，也可用 `duration` 设为 3 到 20 秒。
* 输出 720p。

## 必填参数

* `prompt` (string)：编辑指令，去除首尾空白后 1–26,000 个字符。
* `video_url` (string)：源视频的公开 HTTP(S) URL，3–20 秒，最大 100 MB。

## 可选参数

* `duration` (integer)：输出时长，`3`–`20` 秒。默认为源视频时长。
* `resolution` (string)：`720p`。默认 `720p`。
* `reference_image_urls` (string\[])：最多 10 个公开的 HTTP(S) 图片 URL，用 `@Image1`、`@Image2`… 引用。
* `reference_video_urls` (string\[])：最多 4 个公开的 HTTP(S) 视频 URL，每个 3–20 秒，用 `@Video1`、`@Video2`… 引用。
* `kling_elements` (object\[])：最多 7 个主体，其中视频主体最多 3 个，用 `@Element1`、`@Element2`… 引用。每个主体二选一：
  * `element_input_urls` (string\[])：该主体的 2–4 个图片 URL。
  * `element_input_video_urls` (string\[])：该主体的恰好 1 个视频 URL，3–8 秒。

## 输出

任务完成后，[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口和回调内容的 `files` 数组中返回一个 720p MP4 视频。

## 示例

* **季节变换**：把雪中松林改成金色秋季白桦林，赤狐的步态和镜头跟拍保持不变，5 秒 ([结果](https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0-flash/video-edit/v1/01/output.mp4))。

## 注意事项

* 输入视频（MP4、MOV 或 WebM，每个最大 100 MB）在提交时下载并测量时长，须包含视频轨。参考视频和源视频为 3–20 秒，主体视频为 3–8 秒，全部输入视频合计最多 20 秒。
* 每个主体只接收 `element_input_urls` 或 `element_input_video_urls`；主体中的其他键（如 `voice_id`）返回 400。
* `model` 和 `callback_url` 放在请求根级，与 `input` 并列。`input` 接收上文列出的字段，其他字段返回 400。
* 积分在提交时预扣。只含图片和文本的请求按输出秒数以 720p 费率计费。含输入视频（参考视频、视频主体或源视频）的请求按输入视频费率计费，计费秒数 = 输出时长 + max(输出时长, 全部输入视频总时长向上取整)。任务失败全额退还。省略 `duration` 时，输出时长按源视频时长向上取整计。当前费率见[定价页](https://vidgo.ai/apis/api-pricing)。


## OpenAPI

````yaml zh/api-manual/video-series/kwaivgi-kling-v4-0-flash-video-edit.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Kling 4.0 Flash 视频编辑
  description: Kling 4.0 Flash 视频编辑 API 按提示词编辑 3–20 秒的源视频，可加参考图、参考视频和主体引导，输出 720p。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Kling 4.0 Flash Video Edit
      summary: 提交 Kling 4.0 Flash 视频编辑 任务
      operationId: submitKling40FlashVideoEditTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              season-change:
                summary: 改变视频季节
                value:
                  model: kwaivgi/kling-v4.0-flash/video-edit
                  input:
                    prompt: >-
                      Transform the snowy winter pine clearing into a misty
                      golden autumn birch forest carpeted with crisp fallen
                      amber and crimson leaves, with soft warm morning sunlight
                      filtering through yellow foliage. Preserve the red fox's
                      exact trotting gait, pause, ear turn, and steady lateral
                      camera tracking completely intact. No text, no logos, no
                      watermarks.
                    video_url: >-
                      https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0-flash/text-to-video/v1/01/output.mp4
                    duration: 5
                    resolution: 720p
      responses:
        '200':
          description: 任务提交结果。任务 ID 标识一项异步任务；生成可能仍在进行中。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: kwaivgi/kling-v4.0-flash/video-edit
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook URL，用于接收完成或失败通知。
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
            - video_url
          additionalProperties: false
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 26000
              description: >-
                编辑指令。按顺序引用参考素材，如 @Image1、@Video1 或 @Element1。去除首尾空白后 1–26,000
                个字符。
            video_url:
              type: string
              format: uri
              description: 要编辑的源视频：公开可访问的 HTTP(S) URL，3–20 秒，最大 100 MB（MP4、MOV 或 WebM）。
            duration:
              type: integer
              minimum: 3
              maximum: 20
              description: 输出时长，3–20 的整数秒。省略时跟随源视频时长。
            resolution:
              type: string
              enum:
                - 720p
              default: 720p
              description: 输出分辨率。Kling 4.0 Flash 输出 720p 视频。
            reference_image_urls:
              type: array
              maxItems: 10
              items:
                type: string
                format: uri
                description: 使用公开可访问的 HTTP(S) 下载链接。
              description: 最多 10 张参考图，在提示词中用 @Image1、@Image2 等引用。
            reference_video_urls:
              type: array
              maxItems: 4
              items:
                type: string
                format: uri
                description: 使用公开可访问的 HTTP(S) 下载链接。
              description: >-
                最多 4 个参考视频，在提示词中用 @Video1、@Video2 等引用。每个视频 3–20 秒，最大 100
                MB（MP4、MOV 或 WebM）。
            kling_elements:
              type: array
              maxItems: 7
              items:
                type: object
                additionalProperties: false
                properties:
                  element_input_urls:
                    type: array
                    minItems: 2
                    maxItems: 4
                    items:
                      type: string
                      format: uri
                    description: 同一角色或物体的 2–4 张公开可访问的 HTTP(S) 图片。
                  element_input_video_urls:
                    type: array
                    minItems: 1
                    maxItems: 1
                    items:
                      type: string
                      format: uri
                    description: 恰好 1 个公开可访问的 HTTP(S) 主体视频，3–8 秒。
                description: 一个主体。element_input_urls 和 element_input_video_urls 二选一。
              description: 最多 7 个主体（可复用的角色或物体），其中视频主体最多 3 个。在提示词中用 @Element1、@Element2 等引用。
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: RWNYZX4GKVV4WF0U
            status:
              type: string
              example: not_started
            created_time:
              type: string
              format: date-time
              example: '2026-11-25T11:17:25'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: 错误信息。参见[错误码](/zh/api-manual/error-codes)。
          example: video_url is required for video-edit
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用 `Authorization: Bearer VIDGO_API_KEY`。'

````

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