可灵 4.0 参考生视频

kwaivgi/kling-v4.0/reference-to-video

使用图片、视频和音频参考生成 3–30 秒视频,支持提示词引用及 720p、1080p。

示例

可灵 4.0 参考生视频 示例 1

参数

名称类型默认约束说明
prompt *提示词textarea—≤ 5000 chars用于生成的正向提示词。参考图片请按数组顺序写作 @Image1、@Image2……;参考视频写作 @Video1、@Video2……;参考音频写作 @Audio1、@Audio2……
images参考图片image_upload—image/* · 0–10 items参考图片(最多 10 张)。
audios参考音频audio_upload_group—audio/* · 0–3 items最多 3 段参考音频,每段 5–30 秒,用于引导视频中的声音和语音。
keep_original_sound保留原声booleanfalse—保留参考视频的原声;需提供参考视频。关闭时生成新音频。
resolution分辨率select720p720p | 1080p输出分辨率。
duration时长select53 ~ 30 · step 1 · 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | …生成视频的时长(秒),范围为 3-30。
aspect_ratio宽高比selectautoauto | 16:9 | 9:16 | 1:1 | 21:9输出视频的宽高比;自动模式跟随参考图片或视频。

输出字段

字段类型说明
videosarray<string>

API

通过统一 REST API 调用本模型;在 API Keys 页获取密钥。

cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/reference-to-video" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
    "keep_original_sound": false,
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "auto"
  }
}'

# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"
Python
import time, requests

API_KEY = "YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

# 1) Submit
resp = requests.post(
    "https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/reference-to-video",
    headers=HEADERS,
    json={
        "input": {
            "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
            "keep_original_sound": False,
            "resolution": "720p",
            "duration": 5,
            "aspect_ratio": "auto"
        }
    },
)
resp.raise_for_status()  # 401/402/429/5xx stop here instead of polling a bad task
task = resp.json()

# 2) Poll until a terminal state (completed / failed / cancelled).
#    This model is allowed up to 1800s server-side.
deadline = time.time() + 1860
while task.get("status") not in ("completed", "failed", "cancelled"):
    if time.time() > deadline:
        raise TimeoutError(f"still {task.get('status')} — keep the task_uuid and poll later")
    time.sleep(3)
    poll = requests.get(f"https://www.namifusion.com/api/v1/marketplace/run/tasks/{task['task_uuid']}", headers=HEADERS)
    poll.raise_for_status()
    task = poll.json()

print(task["status"], task.get("output"))
JavaScript
const API_KEY = "YOUR_API_KEY";
const HEADERS = { Authorization: `Bearer ${API_KEY}` };

// 1) Submit
const resp = await fetch("https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/reference-to-video", {
  method: "POST",
  headers: { ...HEADERS, "Content-Type": "application/json" },
  body: JSON.stringify({
    "input": {
      "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
      "keep_original_sound": false,
      "resolution": "720p",
      "duration": 5,
      "aspect_ratio": "auto"
    }
  }),
});
if (!resp.ok) throw new Error(`submit failed: ${resp.status} ${await resp.text()}`);
let task = await resp.json();

// 2) Poll until a terminal state (completed / failed / cancelled).
//    This model is allowed up to 1800s server-side.
const deadline = Date.now() + 1860 * 1000;
while (!["completed", "failed", "cancelled"].includes(task.status)) {
  if (Date.now() > deadline) throw new Error(`still ${task.status} — keep the task_uuid and poll later`);
  await new Promise((r) => setTimeout(r, 3000));
  const poll = await fetch(`https://www.namifusion.com/api/v1/marketplace/run/tasks/${task.task_uuid}`, { headers: HEADERS });
  if (!poll.ok) throw new Error(`poll failed: ${poll.status}`);
  task = await poll.json();
}

console.log(task.status, task.output);

文档

Kling 4.0 · 参考素材生视频

结合提示词与可选图片、视频、音频参考生成新的 3–30 秒视频。输出时长可独立于参考视频时长设置。

输入参数

  • prompt:字符串,必填。
  • images:可选图片 URL 数组,最多 10 张。
  • videos:可选视频 URL 数组,最多 5 段;每段源视频至少 3 秒,实际使用的视频总时长最多 30 秒。
  • audios:可选音频 URL 数组,最多 3 段,每段须为 5–30 秒。
  • keep_original_sound:布尔值,默认 false。设为 true 保留参考视频原声,必须同时提供 videos。
  • resolution:"720p"(默认)或 "1080p"。
  • duration:3–30 的整数,默认 5。
  • aspect_ratio:"auto"(默认)、"16:9"、"9:16"、"1:1" 或 "21:9"。

限制与引用方式

images、videos、audios 合计最多 15 个参考文件。超出总计 30 秒的视频内容会被截断。提示词中的 @Image1、@Video1、@Audio1 分别指各数组第 1 项;每种媒体独立从 1 编号。请说明每个参考素材的用途。

标价与预扣积分

是否输入视频720p1080p计费单位
否$0.157$0.235每输出秒
是$0.094$0.141每计费秒

不含参考视频时:费用 = 输出秒数 × 对应分辨率单价。5 秒视频在 720p 下为 $0.785,在 1080p 下为 $1.175。

设输出秒数为 D,V = ceil(min(输入视频总秒数, 30))。含视频输入时,费用 = 单价 × (D + max(D, V))。例如 720p、输出 5 秒、输入视频 8.2 秒,V 为 9,费用为 $1.316,预扣 131.60 积分。

1 美元 = 100 Nami 积分。总积分向上取整到 0.01:积分 = ceil(美元费用 × 10000) / 100。以上为标价,不计促销折扣。

按此公式,图片、参考音频、宽高比和保留原声设置均无额外收费。

MaaS 参数映射

images、videos、audios 在 MaaS 中均保持 URL 数组;不要将 videos 传成单个字符串。 其余已列字段在 MaaS 中保持同名;duration 必须为整数,支持 keep_original_sound 的接口使用布尔值。数组顺序保持不变。

Nami API

使用 Authorization: Bearer YOUR_NAMI_API_KEY 和 Content-Type: application/json,向以下地址发送 POST 请求:

https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/reference-to-video

请求体示例:

{
  "input": {
    "prompt": "Use the person from @Image1, follow the camera movement of @Video1, and use @Audio1 as the voice reference. The person greets the viewer in a quiet studio.",
    "images": [
      "https://example.com/person.jpg"
    ],
    "videos": [
      "https://example.com/camera-reference.mp4"
    ],
    "audios": [
      "https://example.com/voice-reference.mp3"
    ],
    "keep_original_sound": false,
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "auto"
  }
}

请将 example.com 地址替换为可公开访问的素材 URL。取得 task_uuid 后,使用相同鉴权轮询 GET https://www.namifusion.com/api/v1/marketplace/run/tasks/{task_uuid}。成功后从 output.videos 读取生成视频 URL 数组。

相关模型

xAI Grok Imagine Video v1.5 参考图转视频
参考图生视频X Ai

xAI Grok Imagine Video v1.5 参考图转视频

使用提示词和 1-7 张参考图片生成 1-15 秒视频,支持 480p 和 720p。

起 $0.850 / 每次
Vidu Q4 Preview 参考生视频
参考图生视频Vidu

Vidu Q4 Preview 参考生视频

根据提示词生成 3~16 秒视频,可选最多 15 张参考图片和 3 段参考音频,支持宽高比选择、音频生成及 540p~4k 分辨率。

起 $0.475 / 每次
MiniMax H3 参考图生视频
参考图生视频Minimax

MiniMax H3 参考图生视频

MiniMax H3 Reference to Video 可根据自然语言提示词和多模态参考内容生成连贯的 2K 视频,支持图片、视频和音频输入,可引导主体一致性、运动、时序、视觉风格和场景连贯性。提供开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。

起 $0.650 / 每次
MiniMax H3 Singularity 参考生视频 LoRA
参考图生视频Minimax H3 Singularity

MiniMax H3 Singularity 参考生视频 LoRA

生成带原生立体声音频的视频,支持 3–15 秒时长和四档分辨率。支持自定义 LoRA。

起 $0.300 / 每次
MiniMax H3 Singularity 参考生视频
参考图生视频Minimax H3 Singularity

MiniMax H3 Singularity 参考生视频

生成带原生立体声音频的视频,支持 3–15 秒时长和四档分辨率。

起 $0.250 / 每次
Gemini Omni Flash 参考图生视频 API
参考图生视频Google

Gemini Omni Flash 参考图生视频 API

Gemini Omni Flash 参考图生视频可根据一张或多张参考图片和文本提示词生成带同步音频的短视频,保持视觉主体一致性,并依据提供的参考内容进行引导式多模态视频生成。即开即用的 REST 推理 API,性能出色,无冷启动,价格实惠。

起 $1.28 / 每次
Seedance 2.0 Mini 参考生视频
参考图生视频Doubao

Seedance 2.0 Mini 参考生视频

Seedance 2.0 Mini 参考图生视频 (Reference-to-Video) 是字节跳动推出的一款高速度、低成本的视频生成模型,专注于创作具有电影质感的多镜头视频。该模型能够完美融合参考图与文本提示词,生成极具叙事感的连续视频片段。它不仅支持灵动的 AI 镜头控制,更攻克了跨场景角色一致性的难题。模型支持从 480P 到 4K 的多分辨率输出,时长跨越 4-15 秒,并适配灵活的宽高比。提供开箱即用的 REST 推理 API,性能卓越,告别冷启动,是极具性价比的专业视频创作利器

起 $0.3591 / 每次
Seedance 2.5 参考图/视频转视频
参考图生视频Doubao

Seedance 2.5 参考图/视频转视频

Seedance 2.5 的“参考生视频”功能是视觉统一的终极方案。它能精准提取参考素材的艺术风格、光影基调或构图意向,并将其完美融入新生成的视频中,确保您的系列创作拥有高度一致的视觉语言。

起 $0.6565 / 每次