登录
开发者文档

可灵 4.0

可灵 4.0 文生视频与图生视频 API:720p / 1080p 两档写在模型名里,3–30 秒按秒计费,参考图与参考音频,经 POST /v1/videos 异步提交

POST /v1/videos,model 为 kling-4.0-720p 或 kling-4.0-1080p。 分辨率写在模型名里,请求体里的 resolution / size 会被模型名覆盖。按秒计费,见视频生成。本页结论来自对本网关的真实调用,最后验证:2026-10-31。

基本调用

# 1. 提交
curl https://www.vibeapi.cn/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-4.0-720p",
    "prompt": "一只橘猫在草地上追蝴蝶,阳光柔和,镜头缓慢跟随",
    "duration": 5,
    "aspect_ratio": "16:9"
}'

# 2. 轮询(每 10~15 秒一次)
curl "https://www.vibeapi.cn/v1/videos/$TASK_ID" -H "Authorization: Bearer $API_KEY"

# 3. 取片
curl -L "https://www.vibeapi.cn/v1/videos/$TASK_ID/content" \
  -H "Authorization: Bearer $API_KEY" -o output.mp4
import time, requests

BASE = "https://www.vibeapi.cn/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}

task = requests.post(f"{BASE}/videos", headers=H, json={
    "model": "kling-4.0-720p",
    "prompt": "一只橘猫在草地上追蝴蝶,阳光柔和,镜头缓慢跟随",
    "duration": 5,               # 整数,3–30 秒
    "aspect_ratio": "16:9",
}).json()

while True:
    s = requests.get(f"{BASE}/videos/{task['id']}", headers=H).json()
    if s["status"] in ("completed", "failed"):
        break
    time.sleep(12)

if s["status"] == "completed":
    url = s.get("metadata", {}).get("url") or f"{BASE}/videos/{task['id']}/content"
    open("output.mp4", "wb").write(requests.get(url, headers=H).content)
import fs from "fs";

const BASE = "https://www.vibeapi.cn/v1";
const H = { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

const task = await (await fetch(`${BASE}/videos`, {
  method: "POST",
  headers: H,
  body: JSON.stringify({
    model: "kling-4.0-720p",
    prompt: "一只橘猫在草地上追蝴蝶,阳光柔和,镜头缓慢跟随",
    duration: 5,               // 整数,3–30 秒
    aspect_ratio: "16:9",
  }),
})).json();

let s;
while (true) {
  s = await (await fetch(`${BASE}/videos/${task.id}`, { headers: H })).json();
  if (s.status === "completed" || s.status === "failed") break;
  await sleep(12_000);
}

if (s.status === "completed") {
  const url = s.metadata?.url ?? `${BASE}/videos/${task.id}/content`;
  fs.writeFileSync("output.mp4", Buffer.from(await (await fetch(url, { headers: H })).arrayBuffer()));
}

型号

型号输出时长计费
kling-4.0-720p720p,如 16:9 出 1280×7203–30 秒按秒
kling-4.0-1080p1080p,如 9:16 出 1080×19203–30 秒按秒

两档参数完全一样,只是清晰度和单价不同。实测 5 秒 720p、3 秒 1080p 都在 4 分钟左右出片。单价见 https://www.vibeapi.cn/pricing

参数

字段类型必填说明
modelstring是kling-4.0-720p 或 kling-4.0-1080p
promptstring是描述主体、动作、场景与镜头
durationinteger是输出时长,3–30 秒,按这个秒数计费
aspect_ratiostring否支持各种比例,如 16:9、9:16、1:1
imagesstring[]否参考图片的 HTTPS 地址,最多 10 张,每张不超过 10 MB,按传入顺序参考
audiosstring[]否参考音频的 HTTPS 地址,最多 3 段,每段 5–30 秒、不超过 20 MB
  • 分辨率只认模型名。请求体里另写 resolution 不报错,但会被换成模型名里的档位。
  • 只传一张参考图时,也可以写 image 或 input_reference;三者同时传以 images 为准。
  • 素材地址必须是公网可直接下载的直链,要登录、要 Cookie、分享页都不行。

图生视频

curl https://www.vibeapi.cn/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-4.0-1080p",
    "prompt": "保持参考图中的主体外观,镜头缓慢推进,画面自然微动",
    "images": ["https://your-cdn.example.com/subject.jpg"],
    "duration": 5,
    "aspect_ratio": "9:16"
  }'

参考音频用同样的顶层数组写法,和参考图一起传:

{
  "images": ["https://your-cdn.example.com/subject.jpg"],
  "audios": ["https://your-cdn.example.com/rhythm.wav"]
}

已知限制(截至 2026-10-31)

限制说明怎么办
暂不收参考视频请求带 videos 时返回 400 reference_videos_unsupported去掉 videos;要参考动作或运镜,可以先截一帧作参考图
分辨率只认模型名resolution / size 会被模型名里的档位覆盖换分辨率就换模型名
时长 3–30 秒超出范围会在提交时被拒,额度不扣按需要的秒数传,每多一秒都计费

最后更新于