> ## 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 文生影片的提示詞、音訊、畫幅和時長引數。

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

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

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

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

<link rel="alternate" hrefLang="x-default" href="https://mixroute.ai/docs/api-reference/endpoint/kling-text-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 |

## 請求引數

| 欄位 | 型別 | 必填 | 說明 |
| - | - | - | - |
| `prompt` | string | 是 | 非空文本，可包含正向和負向描述。3.0/3.0 Turbo 最多 3072 字元，建議不超過 2500；2.6/2.5 Turbo 最多 2500。 |
| `settings.resolution` | string | 否 | 預設 720p；按上表選擇小寫 720p、1080p 或 4k。 |
| `settings.duration` | integer | 否 | 預設 5。3.0/3.0 Turbo 為 3-15 的整數；2.6/2.5 Turbo 僅 5 或 10。 |
| `settings.aspect_ratio` | string | 否 | 16:9（預設）、9:16 或 1:1。 |
| `settings.audio` | string | 否 | 僅 3.0/2.6：off（預設）或 native；2.6 使用 native 必須設 1080p。3.0 Turbo 內建音訊，不傳此欄位；2.5 Turbo 不支援此欄位。 |
| `settings.multi_shot` | boolean | 否 | 僅 3.0：預設 true；false 停用多鏡頭生成。Turbo 不提供此開關，可通過分鏡提示詞控制。 |

3.0 和 3.0 Turbo 的分鏡格式為 `shot n, m, words;`：1-6 個鏡頭，每個至少 1 秒，鏡頭時長之和等於總時長，每鏡提示詞最多 512 字元。影像素材不要傳入文生端點。

## 請求示例

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

```bash theme={null}
curl --request POST "https://api.mixroute.ai/kling/text-to-video/kling-3.0" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "prompt": "A red ceramic mug slowly rotates on a white tabletop. Static camera, soft studio lighting.",
  "settings": {
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "16:9",
    "audio": "off",
    "multi_shot": false
  },
  "options": {
    "watermark_info": {
      "enabled": 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.