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

# Kling 4.0

> Kling 4.0 的请求参数、扣费和示例

使用 MaxAPI 的 [API 密钥](https://docs.maxapi.io/cn/api-reference/authentication.md)提交任务。

| 字段 | 取值 |
| - | - |
| `model` | `kling-4.0` |
| `input.prompt` | 必填，1–5000 字符 |
| `input.duration` | 整数 3–30 秒，默认 5 秒 |
| `input.resolution` | `720p` 或 `1080p`，默认 `720p` |
| `input.ratio` | `16:9`、`9:16`、`1:1`、`21:9`，默认 `16:9` |
| `input.mode` | `text-to-video`、`image-to-video`、`reference-to-video` 或 `first-last-frame` |
| `input.imageUrls` | 可公开访问的 HTTP(S) 图片 URL，最多 10 张 |

文生视频传 0 张图片，图生视频传 1 张，首尾帧传 2 张，参考图模式传 1–10 张。省略 `mode` 时，按 0 张、1 张、多张分别推断为文生视频、图生视频、参考图模式。当前支持文字和图片输入。

| 分辨率 | 每秒售价 | 10 秒实际扣分 |
| - | -: | -: |
| 720p | \$0.155 | 155 积分 |
| 1080p | \$0.233 | 233 积分 |

按秒计算总价后向上取整到整积分，1 积分等于 \$0.01。比如 5 秒 720p 扣 78 积分，5 秒 1080p 扣 117 积分。

```json theme={null}
{
  "model": "kling-4.0",
  "input": {
    "prompt": "一只纸船在清晨的池塘上漂动，镜头缓慢向前",
    "resolution": "720p",
    "duration": 5
  }
}
```

提交成功后用返回的 `data.taskId` [查询状态](https://docs.maxapi.io/cn/api-reference/query-task.md)，或设置 [Webhook](https://docs.maxapi.io/cn/api-reference/webhook.md)。确认失败（包括内容审核未通过）会全额退款。提交超时请先查任务状态。


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