Kling 3.0 API 文档

将 Kling 3.0 和 Kling Video O3 API 集成到您应用程序的完整指南。

API v1.0 Base URL: https://kling3api.com

快速开始

bash
1curl -X POST 'https://kling3api.com/api/generate' \
2 -H 'Authorization: Bearer YOUR_API_KEY' \
3 -H 'Content-Type: application/json' \
4 -d '{
5 "type": "pro-text-to-video",
6 "prompt": "A cinematic shot of mountains at sunrise",
7 "duration": 5,
8 "aspect_ratio": "16:9"
9 }'

身份认证

所有 API 请求都需要在 Authorization 头中使用 Bearer 令牌进行身份验证。

获取 API 密钥: 您可以在控制面板的 API Keys 页面获取您的 API 密钥。 → 获取 API 密钥

http
1Authorization: Bearer YOUR_API_KEY

可用模型

3.0

Kling 3.0

高质量 4K 视频生成

类型描述时长积分
pro-text-to-videoPro 品质文生视频3-15s54/s (no audio) · 80/s (with audio)
pro-image-to-videoPro 品质图生视频3-15s54/s (no audio) · 80/s (with audio)
std-text-to-video标准品质文生视频3-15s40/s (no audio) · 60/s (with audio)
std-image-to-video标准品质图生视频3-15s40/s (no audio) · 60/s (with audio)
O3

Kling Video O3

支持参考图/视频编辑的新一代模型

类型描述时长积分
o3-pro-text-to-videoO3 Pro 文生视频3-15s48/s
o3-pro-image-to-videoO3 Pro 图生视频3-15s48/s
o3-pro-reference-to-videoO3 Pro 参考图/视频生成3-15s72/s
o3-pro-video-editO3 Pro 视频编辑auto435 fixed
o3-std-text-to-videoO3 标准 文生视频3-15s36/s
o3-std-image-to-videoO3 标准 图生视频3-15s36/s
o3-std-reference-to-videoO3 标准 参考生成3-15s20/s
o3-std-video-editO3 标准 视频编辑auto360 fixed

API 端点

POST/api/generate

创建新的视频生成任务。API 会根据任务类型自动路由到正确的后端。

请求体

Body ParametersJSON
type:string

任务类型(如 pro-text-to-video, o3-pro-reference-to-video)

prompt:string

视频描述文本(最多 2000 字符)

duration:optional number

视频时长(秒)。Kling 3.0: 3-15。O3: 3-15。 Defaults to 5.

aspect_ratio:optional string

输出宽高比(16:9, 9:16, 1:1) Defaults to 16:9.

image:optional string

图生视频任务的图片 URL

end_image:optional string

结束帧图片 URL(仅限图生视频)

video:optional string

参考视频或视频编辑任务的视频 URL

images:optional string[]

参考图片 URL 数组(O3 参考生成,最多 7 张)

sound:optional boolean

启用原生音频生成 Defaults to true.

negative_prompt:optional string

负面提示词,避免生成某些元素

cfg_scale:optional number

提示词遵循度(0-1,仅限 Kling 3.0) Defaults to 0.5.

Kling 3.0 - 文生视频

json
1{
2 "type": "pro-text-to-video",
3 "prompt": "A majestic eagle soaring through clouds at sunset",
4 "duration": 5,
5 "aspect_ratio": "16:9",
6 "sound": true
7}

Kling 3.0 - 图生视频

json
1{
2 "type": "pro-image-to-video",
3 "prompt": "The character slowly turns and smiles",
4 "image": "https://example.com/my-image.jpg",
5 "duration": 5
6}

Kling O3 - 参考生成

json
1{
2 "type": "o3-pro-reference-to-video",
3 "prompt": "The character walks through a futuristic city",
4 "images": [
5 "https://example.com/character-reference.jpg",
6 "https://example.com/style-reference.jpg"
7 ],
8 "duration": 5,
9 "aspect_ratio": "16:9"
10}

Kling O3 - 视频编辑

json
1{
2 "type": "o3-pro-video-edit",
3 "prompt": "Change the background to a snowy mountain landscape",
4 "video": "https://example.com/original-video.mp4",
5 "keep_original_sound": true
6}

响应

Task created successfully

1{
2 "code": 200,
3 "message": "success",
4 "data": {
5 "task_id": "n75abc123kling3",
6 "status": "IN_PROGRESS",
7 "consumed_credits": 400
8 }
9}
GET/api/status

检查视频生成任务的状态。根据 task_id 前缀路由(n75 为 Kling 3.0,n71 为 Kling O3)。

查询参数

Body ParametersJSON
task_id:string

生成接口返回的唯一任务 ID(如 n75xxx 为 Kling 3.0,n71xxx 为 O3)

请求示例

bash
1curl -X GET 'https://kling3api.com/api/status?task_id=n75abc123kling3' \
2 -H 'Authorization: Bearer YOUR_API_KEY'

💡 Tip: 状态 API 中的 response 字段是一个视频 URL 数组,您可以直接通过 data.response[0] 获取视频 URL。

javascript
1// Extract video URL from response
2const videoUrl = data.response[0];

响应

1{
2 "code": 200,
3 "message": "success",
4 "data": {
5 "task_id": "n75abc123kling3",
6 "status": "SUCCESS",
7 "consumed_credits": 400,
8 "created_at": "2026-02-05T10:30:00Z",
9 "request": {
10 "type": "pro-text-to-video",
11 "prompt": "A majestic eagle soaring through clouds at sunset",
12 "duration": 5,
13 "aspect_ratio": "16:9"
14 },
15 "response": [
16 "https://cdn.example.com/videos/abc123.mp4"
17 ],
18 "error_message": null,
19 "type": "pro-text-to-video"
20 }
21}

API 测试工具

直接在浏览器中测试 API。将 YOUR_API_KEY 替换为您的实际 API 密钥。

API 测试沙盒POST

错误代码

StatusCodeDescription
400 错误请求INVALID_PROMPT提示词无效或为空
400 错误请求INVALID_DURATION时长超出支持范围
400 错误请求INVALID_TYPE不支持的任务类型
400 错误请求MISSING_IMAGE图生视频任务需要提供图片
400 错误请求MISSING_VIDEO视频编辑任务需要提供视频
401 未授权INVALID_API_KEYAPI 密钥缺失或无效
402 INSUFFICIENT_CREDITS积分不足
429 请求过多RATE_LIMITED请求过于频繁,请稍后再试
500 服务器内部错误INTERNAL_ERROR服务器错误,请稍后重试