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

# Kling 圖生影片

> Kling 首幀、首尾幀、Element 與音色輸入引數。

<link rel="alternate" hrefLang="en" href="https://mixroute.ai/docs/api-reference/endpoint/kling-image-to-video" />

<link rel="alternate" hrefLang="zh-Hans" href="https://mixroute.ai/docs/zh-hans/api-reference/endpoint/kling-image-to-video" />

<link rel="alternate" hrefLang="zh-Hant" href="https://mixroute.ai/docs/zh-hant/api-reference/endpoint/kling-image-to-video" />

<link rel="alternate" hrefLang="ja" href="https://mixroute.ai/docs/ja/api-reference/endpoint/kling-image-to-video" />

<link rel="alternate" hrefLang="x-default" href="https://mixroute.ai/docs/api-reference/endpoint/kling-image-to-video" />

使用 MixRoute API Key，以 `Authorization: Bearer $MIXROUTE_API_KEY` 認證，請求體為 JSON。模型 ID 位於 URL 中，不在請求體中重複傳 `model`；不新增 `/v1`，也不使用 `metadata` 包裝。

## 支援模型

| 模型 ID | 解析度 | 普通生成時長（秒） |
| - | - | - |
| [kling-3.0](/docs/zh-hant/model-api/kuaishou/kling-3.0) | 720p / 1080p / 4k | 3-15 |
| [kling-3.0-turbo](/docs/zh-hant/model-api/kuaishou/kling-3.0-turbo) | 720p / 1080p | 3-15 |
| [kling-2.6](/docs/zh-hant/model-api/kuaishou/kling-2.6) | 720p / 1080p | 5 / 10 |
| [kling-2.5-turbo](/docs/zh-hant/model-api/kuaishou/kling-2.5-turbo) | 720p / 1080p | 5 / 10 |

## 素材內容

| 欄位 | 型別 | 必填 | 說明 |
| - | - | - | - |
| `contents` | object\[] | 是 | 輸入集合。必須提供首幀，不支援只傳尾幀；各項 type 與附屬欄位放在同一物件。 |
| `contents[].type` | string | 是 | 每項必填。prompt、first\_frame；last\_frame 適用於 3.0/2.6/2.5 Turbo；element 僅 3.0；voice 僅 2.6。 |
| `contents[].text` | string | 按型別 | prompt 項必填。3.0 最多 3072 字元（建議 2500）；其他型號最多 2500。 |
| `contents[].url` | string | 按型別 | first\_frame/last\_frame 項必填，公網圖片 URL 或 Base64。 |
| `contents[].element_id` | string | 按型別 | element 項必填，3.0 最多引用 3 個 Element。 |
| `contents[].voice_id` | string | 按型別 | voice 項必填，2.6 最多引用 2 個音色，須使用 audio=native 與 1080p。 |
| `contents[].id` | string | 按型別 | element/voice 項必填，同任務不可重複，用 @id 在提示詞中引用。 |

## 生成設定

| 欄位 | 型別 | 必填 | 說明 |
| - | - | - | - |
| `settings.resolution` | string | 否 | 預設 720p。3.0 可用 720p/1080p/4k，其他型號僅 720p/1080p。2.6/2.5 Turbo 首尾幀模式必須 1080p。 |
| `settings.duration` | integer | 否 | 預設 5。3.0/3.0 Turbo 為 3-15；2.6/2.5 Turbo 僅 5 或 10。 |
| `settings.audio` | string | 否 | 3.0/2.6 支援 off（預設）或 native。2.6 原生音訊只支援 1080p。3.0 Turbo 和 2.5 Turbo 不傳此欄位。 |
| `settings.multi_shot` | boolean | 否 | 僅 3.0，預設 true。false 時多鏡頭提示詞不產生多鏡頭輸出。 |

普通圖生端點不提供 `aspect_ratio`，畫幅跟隨輸入影像。3.0 Turbo 僅首幀，不支援尾幀、Element 或音色引用。3.0 使用 Element 時在提示詞中寫 `@id`，名稱不要互相包含；其分鏡提示詞規則與文生影片一致。

## 圖片限制

JPG/JPEG/PNG，單張不超過 50 MB，寬和高均至少 300 px，寬高比介於 1:2.5 和 2.5:1。使用首幀或首幀+尾幀；不要只傳尾幀。資產 ID 的可訪問性取決於上游路由賬戶。

## 請求示例

先設定環境變數 `MIXROUTE_API_KEY`。將 `example.com` 媒體地址替換為無需登入即可訪問的真實素材。

```bash theme={null}
curl --request POST "https://api.mixroute.ai/kling/image-to-video/kling-3.0" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "contents": [
    {
      "type": "prompt",
      "text": "A closed gift box slowly opens to reveal a ceramic mug."
    },
    {
      "type": "first_frame",
      "url": "https://example.com/first.png"
    },
    {
      "type": "last_frame",
      "url": "https://example.com/last.png"
    }
  ],
  "settings": {
    "resolution": "1080p",
    "duration": 5,
    "audio": "native",
    "multi_shot": false
  }
}'
```

通用選項見 [Kling 概覽](/docs/zh-hant/api-reference/endpoint/kling)。

## 提交響應

```json theme={null}
{
  "code": 0,
  "message": "",
  "request_id": "REQUEST_ID",
  "data": {
    "id": "task_example",
    "status": "submitted"
  }
}
```

儲存 `data.id`，使用 [查詢 Kling 任務](/docs/zh-hant/api-reference/endpoint/kling-tasks) 輪詢至 `succeeded` 或 `failed`。提交成功不代表生成完成。


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