搜索

搜索 HiAPI 模型、工具和资源。

返回博客
教程3 分钟阅读

Kling 3.0 Omni API 怎么用?四个入口 5 分钟跑通

文生、图生、参考生、视频改写分别怎么调,curl 和 Python 示例,每秒价格和上线注意事项。

HiAPI 编辑部Kling 3.0 OmniAPI 教程视频生成

TL;DR

  • Kling 3.0 Omni 是可灵的全能视频模型,在 HiAPI 上分文生视频、图生视频、参考生视频、视频改写四个入口,打开模型页 就能在线生成,新用户注册送 200 积分。
  • 按秒计费:720p 每秒 $0.10 起,1080p 每秒 $0.129 起,4K 每秒 $0.479;开声音、带参考视频另有单价。
  • API 同一个 /v1/tasks 接口,只换 model 和 input。下面的 curl 和 Python 复制就能跑。

四个入口分别做什么?

模型 ID输入适合
kling-3.0-omni/text-to-video提示词从零出镜头
kling-3.0-omni/image-to-video1 张首帧,或首帧 + 尾帧让一张图动起来
kling-3.0-omni/reference-to-video1–7 张参考图,可加 1 段参考视频锁定人物、商品,或照着参考视频运镜
kling-3.0-omni/transformation1 段原视频保留运镜和动作,换场景和风格

四个入口都能选分辨率 720p、1080p、4k。文生和参考生可设时长(3–15 秒)、画幅(16:9、9:16、1:1)和声音(audio);图生可设时长和声音,画幅跟随首帧;视频改写只传提示词、原视频和分辨率,时长和画幅跟随原视频,不出声音。文生、图生、参考生还支持智能多镜头(prefer_multi_shots),四个入口都能用可复用主体(elements,提示词里写 @名字)。

下面这条 3 秒 720p 的雨夜纸船,就是一句提示词直接出的:

A paper boat drifts down a rain-soaked city gutter at dusk, neon signs reflecting and rippling on the water; the camera glides low beside it as raindrops splash around. Cinematic, shallow depth of field, smooth tracking motion.

用这个提示词生成 →

两条上手路线

在线试用(不写代码)

  1. 打开对应模型页(比如 文生视频),注册或登录。
  2. 粘贴提示词,选时长、分辨率、画幅,按需打开声音。
  3. 点生成,出片后直接下载。

API 调用

  1. 在控制台创建 API Key。
  2. POST https://api.hiapi.ai/v1/tasks 提交,返回 taskId。
  3. GET /v1/tasks/{taskId} 查状态,status 为 success 时从 output[0].url 下载。

curl:文生视频

curl -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer $HIAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-3.0-omni/text-to-video",
    "input": {
      "prompt": "A paper boat drifts down a rain-soaked city gutter at dusk, neon signs reflecting on the water.",
      "duration": 5,
      "resolution": "720p",
      "audio": false,
      "aspect_ratio": "16:9"
    }
  }'

Python:提交、轮询、下载

import os, time, requests

H = {"Authorization": f"Bearer {os.environ['HIAPI_KEY']}"}

def generate(model, **inp):
    r = requests.post("https://api.hiapi.ai/v1/tasks",
                      json={"model": model, "input": inp}, headers=H)
    task_id = r.json()["data"]["taskId"]
    while True:
        d = requests.get(f"https://api.hiapi.ai/v1/tasks/{task_id}", headers=H).json()["data"]
        if d["status"] == "success":
            return d["output"][0]["url"]
        if d["status"] in ("fail", "failed"):
            raise RuntimeError(d)
        time.sleep(10)

url = generate(
    "kling-3.0-omni/image-to-video",
    prompt="Morning fog slowly lifts over the harbor, camera slowly pushes in along the dock.",
    image_urls=["https://your-cdn.example.com/harbor.jpg"],
    duration=5, resolution="720p",
)
open("clip.mp4", "wb").write(requests.get(url).content)

另外三个入口怎么写?

图生视频:image_urls 传 1 张是首帧,传 2 张是首帧加尾帧;输出画幅跟随首帧。

Morning fog slowly lifts over the harbor as the fishing boats rock gently on the water; the low sun breaks through the haze and glints on the wet pier, camera slowly pushes in along the dock. Cinematic, calm, photorealistic.

用这个提示词生成 →

参考生视频:image_urls 必填(1–7 张,JPG/PNG,单张不超过 50MB、最短边不少于 300px),可加 1 段 video_urls 当运镜参考(MP4/MOV,3–15.5 秒,不超过 200MB)。下面这条用纸船首帧图做主体参考、上面那段雨夜视频做运镜参考,纸船换到了森林小溪:

The same white paper boat from the reference drifts along a sunlit forest stream at golden hour, leaves floating beside it, camera tracks low alongside it with the same smooth motion as the reference video. Cinematic, shallow depth of field.

用这个提示词生成 →

带参考视频时 audio 必须为 false、不能开智能多镜头,参考图最多 4 张。最小请求:

{
  "model": "kling-3.0-omni/reference-to-video",
  "input": {
    "prompt": "The same white paper boat from the reference drifts along a forest stream",
    "image_urls": ["https://static.hiapi.ai/admin-assets/2026/10/13/1791861888668-6554d6167af93003-kling-omni-boat-frame.jpg"],
    "video_urls": ["https://static.hiapi.ai/admin-assets/2026/10/13/1791861859228-2b40d774dd4b2262-kling-omni-t2v-golden.mp4"],
    "duration": 3,
    "resolution": "720p",
    "audio": false
  }
}

要锁定多个主体,用 elements 给每个主体起名,在提示词里写 @名字,完整写法见 参考生视频提示词案例。

视频改写:video_urls 传 1 段原视频(MP4/MOV,3–15.5 秒,不超过 200MB),提示词写要换成什么。输出时长和画幅跟随原视频,不生成声音。最小请求:

{
  "model": "kling-3.0-omni/transformation",
  "input": {
    "prompt": "Transform the scene into a snowy winter night, keep the exact camera motion",
    "video_urls": ["https://static.hiapi.ai/admin-assets/2026/10/13/1791861859228-2b40d774dd4b2262-kling-omni-t2v-golden.mp4"],
    "resolution": "720p"
  }
}

同一段雨夜纸船,改成了雪夜里发光的纸灯笼船:

Transform the scene into a snowy winter night: the gutter becomes a frozen stream with drifting snowflakes, the paper boat becomes a small glowing paper lantern boat, keep the exact camera motion and water movement from the original video. Cinematic, cold blue tones.

用这个提示词生成 →

多少钱?

入口720p1080p4K
文生 / 图生,关声音$0.10/秒$0.129/秒$0.479/秒
文生 / 图生,开声音$0.129/秒$0.1645/秒$0.479/秒
参考生,无参考视频同上同上同上
参考生,带参考视频$0.143/秒$0.193/秒$0.479/秒
视频改写$0.143/秒$0.193/秒$0.479/秒

一条 5 秒 720p 关声音的文生视频 $0.50,$10 能生成 100 秒;最短的 3 秒只要 $0.30。调提示词先用 720p 和 3–5 秒,定稿再上 1080p 或 4K。失败任务自动退款。

上线前注意

  • 用回调代替轮询:请求顶层加 "callback": {"url": "https://你的域名/hiapi/callback"},任务成功或失败时 HiAPI 主动通知,按 taskId 去重。
  • 视频默认保存约 7 天:拿到 output[0].url 后转存;要长期保留,可以用 HiAPI 的持久存储(按存储量另计费)。
  • 参数按入口写全:文生、图生、参考生显式写 resolution、duration、audio;视频改写只写 resolution,时长跟随原视频。
  • 元素名不带空格:elements[].name 写 serum,提示词里写 @serum。

常见问题

四个入口要分别开通吗?

不用。同一个 API Key,换 model 就行。

能出竖屏吗?

能。文生和参考生的 aspect_ratio 写 9:16;图生跟随首帧比例,视频改写跟随原视频。

声音怎么加?

文生、图生、参考生(无参考视频时)把 audio 设为 true,生成和画面同步的环境音与音效。720p 每秒多 $0.029,1080p 每秒多 $0.0355。

提示词能写中文吗?

能。镜头怎么动、主体做什么、光线和风格分句写清楚效果最稳。

复制上面的雨夜纸船提示词,去模型页生成第一条;更多可复制的案例看 Kling 3.0 Omni 提示词案例,价格细节看 Kling 3.0 API 价格。

现在就用 HiAPI 生成

选一个模型,输入你的提示词,直接查看生成结果。

HiAPI Blog

相关文章

HiAPI

现在就用 HiAPI 生成

开始生成