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

# Kling 文生视频

> Kling 文生视频的提示词、音频、画幅和时长参数。

使用 MixRoute API Key，以 `Authorization: Bearer $MIXROUTE_API_KEY` 认证，请求体为 JSON。模型 ID 位于 URL 中，不在请求体中重复传 `model`；不添加 `/v1`，也不使用 `metadata` 包装。

## 支持模型

| 模型 ID                                                     | 分辨率               | 普通生成时长（秒） |
| --------------------------------------------------------- | ----------------- | --------- |
| [kling-3.0](/cn/model-api/kuaishou/kling-3.0)             | 720p / 1080p / 4k | 3-15      |
| [kling-3.0-turbo](/cn/model-api/kuaishou/kling-3.0-turbo) | 720p / 1080p      | 3-15      |
| [kling-2.6](/cn/model-api/kuaishou/kling-2.6)             | 720p / 1080p      | 5 / 10    |
| [kling-2.5-turbo](/cn/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 概览](/cn/api-reference/endpoint/kling)。

## 提交响应

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

保存 `data.id`，使用 [查询 Kling 任务](/cn/api-reference/endpoint/kling-tasks) 轮询至 `succeeded` 或 `failed`。提交成功不代表生成完成。
