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

# 图生视频（Legacy）

> 接口与可灵官网一致；支持首帧驱动、动态笔刷、运镜控制

* 路径 `POST /kling/v1/videos/image2video`
* 本页对应官方 Legacy 协议；新版请求请使用 [API 2.0](/kling/api2-kling3)。
* 字段详解：请参考[官网权威文档](https://kling.ai/document-api/api/video/3-0-omni/image-to-video/legacy)

请求参数

| 参数                 | 类型      | 必填   | 说明                                                                                                                                                       |
| ------------------ | ------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model_name`       | string  | 否    | 模型名称，默认 `kling-v1`。可选：`kling-v1`、`kling-v1-5`、`kling-v1-6`、`kling-v2-master`、`kling-v2-1`、`kling-v2-1-master`、`kling-v2-5-turbo`、`kling-v2-6`、`kling-v3` |
| `image`            | string  | 条件必填 | 首帧图片 URL 或 Base64；与尾帧至少提供一个，只有支持尾帧独立生成的模型可省略                                                                                                             |
| `image_tail`       | string  | 否    | 尾帧图片 URL 或 Base64                                                                                                                                        |
| `prompt`           | string  | 否    | 文本提示词                                                                                                                                                    |
| `multi_shot`       | boolean | 否    | 是否多镜头，默认false，3.0支持                                                                                                                                      |
| `shot_type`        | string  | 条件必填 | `customize/intelligence`                                                                                                                                 |
| `multi_prompt`     | array   | 条件必填 | 自定义分镜 `{index,prompt,duration}`；最多6段，总时长须一致                                                                                                              |
| `element_list`     | array   | 否    | 3.0主体引用 `[{"element_id":...}]`，最多3个，与voice\_list互斥                                                                                                       |
| `negative_prompt`  | string  | 否    | 负向文本提示词                                                                                                                                                  |
| `voice_list`       | array   | 否    | 语音列表（仅 `kling-v2-6` 支持，最多2个）                                                                                                                             |
| `sound`            | string  | 否    | 是否生成声音：`on`/`off`（按对应模型声音能力使用）                                                                                                                           |
| `cfg_scale`        | number  | 否    | 生成自由度 \[0, 1]，仅 `kling-v1`/`kling-v1-5`/`kling-v1-6` 支持                                                                                                  |
| `mode`             | string  | 否    | 生成模式：`std`、`pro`；3.0额外支持`4k`，默认 `std`                                                                                                                    |
| `static_mask`      | string  | 否    | 静态笔刷涂抹区域                                                                                                                                                 |
| `dynamic_masks`    | array   | 否    | 动态笔刷配置列表（最多6组）                                                                                                                                           |
| `camera_control`   | object  | 否    | 摄像机运动控制                                                                                                                                                  |
| `aspect_ratio`     | string  | 否    | 画面纵横比：`16:9`、`9:16`、`1:1`，默认 `16:9`                                                                                                                      |
| `duration`         | string  | 否    | 视频时长字符串：3.0支持`3`～`15`，其他模型按其支持范围，默认 `5`                                                                                                                  |
| `watermark_info`   | object  | 否    | 是否生成含水印结果                                                                                                                                                |
| `callback_url`     | string  | 否    | 回调通知地址                                                                                                                                                   |
| `external_task_id` | string  | 否    | 自定义任务ID                                                                                                                                                  |

> **重要约束**
>
> * `image` 与 `image_tail` 至少提供一个；V1.5/V1.6 的 pro 模式支持仅尾帧，其余模型请提供首帧。
> * `image + image_tail`、`dynamic_masks/static_mask`、`camera_control` 三组选一，互斥不可同时使用；
> * `voice_list` 仅 `kling-v2-6` 支持，且使用时 `sound=on`、最多 2 个。
> * `kling-v3-omni` 请使用 Omni 视频入口 `/kling/v1/videos/omni-video`。
> * 历史输入 `kling-v2-5` 会归一为 `kling-v2-5-turbo`；Kling 3.0 Turbo 使用 [新版入口](/kling/api2/image-to-video-3-0-turbo)，不使用旧版别名。

动态笔刷配置

```json theme={null}
{
  "dynamic_masks": [
    {
      "mask": "base64编码的掩码图片",
      "trajectories": [
        {"x": 100, "y": 200},
        {"x": 150, "y": 250}
      ]
    }
  ]
}
```

* `trajectories`：运动轨迹坐标序列，以输入图片左下为原点的像素坐标，至少2个点，最多77个点
* `dynamic_masks` 最多 6 组；`static_mask` 与 `dynamic_masks.mask` 分辨率需与 `image` 一致，否则上游可能失败

### 场景一：首帧驱动

```bash theme={null}
curl --request POST \
  --url https://models.kapon.cloud/kling/v1/videos/image2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v1",
    "image": "https://example.com/first-frame.jpg",
    "prompt": "A mouse runs toward the camera, smiling and blinking",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9"
  }'
```

### 场景二：首帧 + 尾帧

```bash theme={null}
curl --request POST \
  --url https://models.kapon.cloud/kling/v1/videos/image2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v1",
    "image": "https://example.com/child.jpg",
    "image_tail": "https://example.com/adult.jpg",
    "prompt": "A little girl grows up",
    "mode": "pro",
    "duration": "10",
    "aspect_ratio": "16:9"
  }'
```

### 场景三：使用摄像机运镜

```bash theme={null}
curl --request POST \
  --url https://models.kapon.cloud/kling/v1/videos/image2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v2-master",
    "image": "https://example.com/landscape.jpg",
    "prompt": "Camera slowly zooms in on the mountain peak",
    "camera_control": {
      "type": "simple",
      "config": {
        "zoom": 5
      }
    },
    "duration": "10",
    "aspect_ratio": "16:9"
  }'
```

示例响应

```json theme={null}
{
  "code": 0,
  "message": "success",
  "request_id": "req_1735558800_xyz789",
  "data": {
    "task_id": "task_01JGHM...",
    "task_status": "submitted",
    "created_at": 1735558800000,
    "updated_at": 1735558800000
  }
}
```


## OpenAPI

````yaml POST /kling/v1/videos/image2video
openapi: 3.0.3
info:
  title: Kling API
  version: '2026-09-07'
  description: API 2.0 与 Legacy 分开定义；请求使用 Kapon Token。
servers:
  - url: https://models.kapon.cloud
security:
  - BearerAuth: []
paths:
  /kling/v1/videos/image2video:
    post:
      tags:
        - Kling
      summary: Image to video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/kling.OfficialImage2VideoRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/kling.OfficialResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    kling.OfficialImage2VideoRequest:
      type: object
      properties:
        aspect_ratio:
          description: 画面纵横比：16:9, 9:16, 1:1
          type: string
        callback_url:
          description: 回调通知地址
          type: string
        camera_control:
          description: 摄像机运动控制
          allOf:
            - $ref: '#/components/schemas/kling.CameraControl'
        cfg_scale:
          description: 生成视频的自由度 [0, 1]
          type: number
        duration:
          description: 视频时长：5, 10
          type: string
        dynamic_masks:
          description: 动态笔刷配置列表（最多6组）
          type: array
          items:
            $ref: '#/components/schemas/kling.DynamicMask'
        element_list:
          type: array
          items:
            $ref: '#/components/schemas/kling.OmniElementItem'
        external_task_id:
          description: 自定义任务ID
          type: string
        image:
          description: 图片URL，必须
          type: string
        image_tail:
          description: 尾帧图片
          type: string
        mode:
          description: 生成模式：std, pro
          type: string
        model_name:
          description: 模型名称，默认kling-v1
          type: string
        multi_prompt:
          type: array
          items:
            $ref: '#/components/schemas/kling.OfficialVideoShot'
        multi_shot:
          type: boolean
        negative_prompt:
          description: 负向文本提示词
          type: string
        prompt:
          description: 文本提示词
          type: string
        shot_type:
          type: string
        sound:
          description: 是否生成声音：on/off
          type: string
        static_mask:
          description: 静态笔刷涂抹区域
          type: string
        voice_list:
          description: 语音列表
          type: array
          items:
            $ref: '#/components/schemas/kling.VoiceItem'
        watermark_info:
          description: 水印信息
          allOf:
            - $ref: '#/components/schemas/kling.OfficialWatermarkInfo'
    kling.OfficialResponse:
      type: object
      properties:
        code:
          description: 错误码
          type: integer
        data:
          description: 单个任务数据
          allOf:
            - $ref: '#/components/schemas/kling.OfficialTaskData'
        data_list:
          description: 任务列表数据（用于列表查询）
          type: array
          items:
            $ref: '#/components/schemas/kling.OfficialTaskData'
        message:
          description: 错误信息
          type: string
        request_id:
          description: 请求ID
          type: string
    kling.CameraControl:
      type: object
      properties:
        config:
          description: 当type为"simple"时必填
          allOf:
            - $ref: '#/components/schemas/kling.CameraControlConfig'
        type:
          description: >-
            "simple", "down_back", "forward_up", "right_turn_forward",
            "left_turn_forward"
          type: string
    kling.DynamicMask:
      type: object
      properties:
        mask:
          description: 动态笔刷涂抹区域
          type: string
        trajectories:
          description: 运动轨迹坐标序列
          type: array
          items:
            $ref: '#/components/schemas/kling.TrajectoryPoint'
    kling.OmniElementItem:
      type: object
      properties:
        element_id:
          description: 主体ID，保留64位整数精度
          type: integer
          format: int64
    kling.OfficialVideoShot:
      type: object
      properties:
        duration:
          type: string
        index:
          type: integer
        prompt:
          type: string
    kling.VoiceItem:
      type: object
      properties:
        voice_id:
          description: 音色ID
          type: string
    kling.OfficialWatermarkInfo:
      type: object
      properties:
        enabled:
          description: 是否生成含水印结果
          type: boolean
    kling.OfficialTaskData:
      type: object
      properties:
        created_at:
          description: 任务创建时间，Unix时间戳、单位ms
          type: integer
        final_balance_deduction:
          type: object
        final_unit_deduction:
          description: 实际扣减积分
          type: string
        platform_id:
          description: One-Hub 平台统一追踪 ID（video_<ULID>）
          type: string
        task_id:
          description: 任务ID — 上游原始任务 ID
          type: string
        task_info:
          description: 任务创建时的参数信息
          allOf:
            - $ref: '#/components/schemas/kling.OfficialTaskInfo'
        task_result:
          description: 任务结果
          allOf:
            - $ref: '#/components/schemas/kling.OfficialTaskResult'
        task_status:
          description: 任务状态
          type: string
        task_status_msg:
          description: 任务状态信息
          type: string
        updated_at:
          description: 任务更新时间，Unix时间戳、单位ms
          type: integer
        watermark_info:
          description: 水印信息
          allOf:
            - $ref: '#/components/schemas/kling.OfficialWatermarkInfo'
    kling.CameraControlConfig:
      type: object
      properties:
        horizontal:
          description: 水平运镜 [-10, 10]
          type: number
        pan:
          description: 水平摇镜 [-10, 10]
          type: number
        roll:
          description: 旋转运镜 [-10, 10]
          type: number
        tilt:
          description: 垂直摇镜 [-10, 10]
          type: number
        vertical:
          description: 垂直运镜 [-10, 10]
          type: number
        zoom:
          description: 变焦 [-10, 10]
          type: number
    kling.TrajectoryPoint:
      type: object
      properties:
        x:
          description: 轨迹点横坐标（以输入图片左下为原点的像素坐标）
          type: integer
        'y':
          description: 轨迹点纵坐标（以输入图片左下为原点的像素坐标）
          type: integer
    kling.OfficialTaskInfo:
      type: object
      properties:
        external_task_id:
          description: 客户自定义任务ID
          type: string
    kling.OfficialTaskResult:
      type: object
      properties:
        videos:
          type: array
          items:
            $ref: '#/components/schemas/kling.OfficialVideoResult'
    kling.OfficialVideoResult:
      type: object
      properties:
        duration:
          description: 视频总时长，单位s
          type: string
        id:
          description: 生成的视频ID
          type: string
        url:
          description: 生成视频的URL
          type: string
        watermark_url:
          description: 含水印视频下载URL
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````