---
title: Kling Image-to-Video
url: https://runapi.ai/zh-CN/docs/api/kling/image-to-video.md
canonical: https://runapi.ai/zh-CN/docs/api/kling/image-to-video
locale: zh-CN
---

# Kling Image-to-Video

## 概览

使用支持的模型创建异步文生视频任务。使用返回的任务 ID 查询状态，或提供 callback_url 接收终态投递。

### 快速开始

1. 创建 API Key，并将其设置为 RUNAPI_API_KEY。
2. 选择一个支持的模型，并发送与该模型 Schema 匹配的 POST 请求。
3. 保存返回的任务 ID，随后轮询到终态，或处理终态回调。

## 端点

POST /api/v1/kling/image_to_video

基础 URL: https://runapi.ai

API 版本: v1

身份验证: Authorization: Bearer YOUR_API_TOKEN

## 支持的模型

打开模型页可查看当前价格、限流和商业使用详情。

- [kling-o1](/models/kling/o1)
- [kling-v2.1-master-image-to-video](/models/kling/v2.1-master-image-to-video)
- [kling-v2.1-pro](/models/kling/v2.1-pro)
- [kling-v2.1-standard](/models/kling/v2.1-standard)
- [kling-v2.5-turbo-image-to-video-pro](/models/kling/v2.5-turbo-image-to-video-pro)
- [kling-v2.6](/models/kling/v2.6)
- [kling-v3-omni](/models/kling/v3-omni)
- [kling-v3-turbo-image-to-video](/models/kling/v3-turbo-image-to-video)

## 请求 Schema

字段和允许的取值取决于所选模型。提供 callback_url 后，它会收到任务终态投递。

### kling-o1

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "Output aspect ratio.",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "Duration in seconds.",
    "enum": [
      5
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "Sound generation must remain disabled.",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "Public HTTP(S) JPG, JPEG, or PNG first-frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Public HTTP(S) JPG, JPEG, or PNG final-frame image URL; cannot be combined with reference_image_urls or reference_video_url.",
    "type": "string"
  },
  "mode": {
    "default": "std",
    "description": "Generation mode.",
    "enum": [
      "std",
      "pro"
    ],
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "preserve_reference_video_audio": {
    "default": false,
    "description": "Preserve the reference video's original audio.",
    "type": "boolean"
  },
  "prompt": {
    "description": "Video description; reference media with matching numbered markers.",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "reference_image_urls": {
    "description": "Ordered public HTTP(S) JPG, JPEG, or PNG reference image URLs; cannot be combined with last_frame_image_url.",
    "items": {
      "type": "string"
    },
    "max_items": 7,
    "min_items": 1,
    "type": "array"
  },
  "reference_video_type": {
    "default": "base",
    "description": "Use the video as a base edit or feature reference.",
    "enum": [
      "base",
      "feature"
    ],
    "type": "string"
  },
  "reference_video_url": {
    "description": "Public HTTP(S) MP4 or MOV reference video URL; cannot be combined with last_frame_image_url.",
    "type": "string"
  }
}
```

### kling-v2.1-master-image-to-video

```json
{
  "aspect_ratio": {
    "description": "Output aspect ratio.",
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "cfg_scale": {
    "description": "Guidance scale (0-1).",
    "type": "number"
  },
  "duration_seconds": {
    "description": "Duration in seconds.",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL for supported image-to-video models.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "Negative prompt.",
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.1-pro

```json
{
  "aspect_ratio": {
    "description": "Output aspect ratio.",
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "cfg_scale": {
    "description": "Guidance scale (0-1).",
    "type": "number"
  },
  "duration_seconds": {
    "description": "Duration in seconds.",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL for supported image-to-video models.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "Negative prompt.",
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.1-standard

```json
{
  "aspect_ratio": {
    "description": "Output aspect ratio.",
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "cfg_scale": {
    "description": "Guidance scale (0-1).",
    "type": "number"
  },
  "duration_seconds": {
    "description": "Duration in seconds.",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL for supported image-to-video models.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "Negative prompt.",
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.5-turbo-image-to-video-pro

```json
{
  "aspect_ratio": {
    "description": "Output aspect ratio.",
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "cfg_scale": {
    "description": "Guidance scale (0-1).",
    "type": "number"
  },
  "duration_seconds": {
    "description": "Duration in seconds.",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL for supported image-to-video models.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "Negative prompt.",
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.6

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "Output aspect ratio.",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "Duration in seconds.",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "Enable sound generation; requires pro mode.",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL; requires pro mode and 5 seconds.",
    "type": "string"
  },
  "mode": {
    "default": "std",
    "description": "Generation mode.",
    "enum": [
      "std",
      "pro"
    ],
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

### kling-v3-omni

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "Output aspect ratio.",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "Duration in seconds.",
    "enum": [
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "Enable synchronized sound generation.",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "Final frame image URL; requires a 5-second duration.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "720p",
    "description": "Output resolution.",
    "enum": [
      "720p",
      "1080p",
      "4k"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

### kling-v3-turbo-image-to-video

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "Duration in seconds.",
    "enum": [
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "First frame image URL.",
    "required": true,
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "720p",
    "description": "Output resolution.",
    "enum": [
      "720p",
      "1080p"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "Video description.",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

## 创建已接受

HTTP 202 - POST /api/v1/kling/image_to_video

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 轮询处理中

HTTP 200 - GET /api/v1/kling/image_to_video/:id

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 轮询已完成

HTTP 200 - GET /api/v1/kling/image_to_video/:id

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 轮询失败

HTTP 200 - GET /api/v1/kling/image_to_video/:id

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 客户回调：已完成

HTTP 200 - POST callback_url

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 客户回调：失败

HTTP 200 - POST callback_url

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 错误

HTTP 400

```json
{
  "error": {
    "code": "invalid_request",
    "message": "A required request field is missing."
  }
}
```

## 生成的代码示例

直接使用 cURL，或安装所用语言的 SDK。每个示例都会提交本参考中经过验证的请求。

### curl

```curl
curl -X POST https://runapi.ai/api/v1/kling/image_to_video \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"kling-o1","prompt":"A gentle camera pan across the scene.","first_frame_image_url":"https://file.runapi.ai/first-frame.png"}'
```

## 相关指南

- [API 身份验证](/docs/guides/authentication)
- [Task API 快速开始](/docs/guides/task-api/quickstart)
