搜索

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

返回博客
教程3 分钟阅读

Seedance 2.5 参考生视频 API:沿用参考视频的运镜换主体

参考视频的时长也计费,费用怎么算、提示词里的 @video1 怎么写,一篇讲清。

HiAPI 编辑部Seedance 2.5API 教程参考生视频

TL;DR

  • seedance-2.5/reference-to-video 拿一段已有视频当参考,保留它的运镜、节奏和动作,再换主体、换画风或配上参考音乐。打开模型页 就能在线生成,新用户注册送 200 积分。
  • 按秒计费,参考视频的时长也算钱:费用 = 单价 ×(参考视频时长 + 输出时长)。480p 每秒 $0.1215,720p $0.2715,1080p $0.68。
  • 5 秒参考 + 5 秒输出:480p $1.215,720p $2.715。先用 480p 调提示词最省钱。

先看一条实际效果:换主体,保留运镜

参考视频是一条跑鞋广告,参考图是一瓶香水。提示词让模型沿用跑鞋广告的镜头顺序和运镜,把鞋整个换成香水:

Use @video1 strictly as the reference for shot progression, product rotation, camera paths, pacing, macro close-ups, and lighting transitions. Replace the shoe completely with the perfume bottle from @image1. Preserve the bottle's exact silhouette, amber glass color, cap proportions, label placement, and premium material appearance in every shot. Present it as a luxury fragrance commercial on a dark obsidian pedestal, with warm amber rim light, controlled reflections, fine atmospheric mist, and precise macro detail. Follow the visual rhythm and camera choreography of @video1 while keeping one consistent perfume bottle throughout. Do not transfer shoe laces, soles, fabric textures, or shoe-shaped geometry into the bottle. Do not invent extra products, readable brand text, logos, hands, or people.

用这个提示词生成 →(上传你的参考视频和产品图,480p、9:16)

seedance-2.5/reference-to-video,480p,9:16,输出 4 秒,声音由模型生成。

@video1、@image1 是提示词里的素材编号,按传入顺序对应 reference_video_urls、reference_image_urls 里的第一个地址。结尾那句「不要把鞋带、鞋底带进香水瓶」和前面的正面描述一样重要:不写清楚,模型会把参考视频里的细节带过来。

curl:第一条视频

curl -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer $HIAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.5/reference-to-video",
    "input": {
      "prompt": "沿用 @video1 的运镜和节奏,把主体换成 @image1 里的产品,光线和构图保持一致",
      "reference_video_urls": ["https://your-cdn.example.com/reference-clip.mp4"],
      "reference_image_urls": ["https://your-cdn.example.com/product.jpg"],
      "duration": 5,
      "resolution": "480p",
      "aspect_ratio": "9:16"
    }
  }'

如果参考视频是 5 秒,这条按 480p 计 10 秒,$1.215。

返回 taskId,再查结果:

curl https://api.hiapi.ai/v1/tasks/tk-hiapi-... \
  -H "Authorization: Bearer $HIAPI_KEY"

status 为 success 后,从 output[0].url 下载视频。

Python:提交、轮询、下载

# pip install requests;先 export HIAPI_KEY=你的 Key
import os, time, uuid, requests

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

def generate(prompt, model="seedance-2.5/reference-to-video", timeout_s=900, **params):
    body = {"model": model, "input": {"prompt": prompt, **params}}
    # 重试提交同一个任务时带同一个 Idempotency-Key,避免重复扣费
    headers = {**H, "Idempotency-Key": str(uuid.uuid4())}
    r = requests.post("https://api.hiapi.ai/v1/tasks", json=body, headers=headers, timeout=30)
    r.raise_for_status()
    res = r.json()
    if res.get("code") != 200:
        raise RuntimeError(res)
    task_id = res["data"]["taskId"]
    deadline = time.time() + timeout_s
    while time.time() < deadline:
        d = requests.get(f"https://api.hiapi.ai/v1/tasks/{task_id}", headers=H, timeout=30).json()["data"]
        if d["status"] == "success":
            return d["output"][0]["url"]
        if d["status"] == "fail":
            raise RuntimeError(d)
        time.sleep(10)
    raise TimeoutError(task_id)

url = generate(
    "保留 @video1 里柯基奔跑的节奏和低机位跟拍,把整个画面改成毛毡定格动画风格",
    reference_video_urls=["https://your-cdn.example.com/corgi-run.mp4"],
    duration=5, resolution="480p", aspect_ratio="16:9",
)
with open("clip.mp4", "wb") as f:
    f.write(requests.get(url).content)

三种常见用法

1. 换主体,保留运镜(上面的香水例子):参考视频 + 参考图。提示词写清楚「从 @video1 拿什么」「从 @image1 拿什么」「什么不要带过来」。

2. 只迁移动作,整体换画风:只传参考视频。下面这条把一段柯基奔跑的实拍,改成毛毡定格动画,奔跑节奏和跟拍运镜都保留:

Use @video1 as the sole visual reference. Preserve the corgi's recognizable markings, running cadence, stride timing, body orientation, forward momentum, and the low side-tracking camera movement. Reimagine the entire scene as a handcrafted stop-motion film made from felt, wool, miniature grass, and painted paper scenery. Keep the warm sunset backlight and continuous chase rhythm, with subtle handmade texture and natural depth of field. Maintain one coherent corgi throughout the shot, anatomically stable legs, smooth forward motion, and a continuous camera path. Do not introduce additional animals, text, logos, abrupt cuts, or unrelated objects.

用这个提示词生成 →(上传你的参考视频)

seedance-2.5/reference-to-video,480p,只用参考视频,输出 4 秒。

3. 视频 + 图片 + 音频一起用:再加 reference_audio_urls,在提示词里用 @audio1 指定哪个画面落在音乐的哪个点上,比只写「配乐」准得多。参考音频必须和参考视频一起传。

参数一览

参数取值说明
prompt字符串,必填用 @video1 @image1 @audio1 引用素材
reference_video_urls必填,1–10 段MP4/MOV,每段 2–30 秒,合计不超过 30 秒,每段小于 200 MB
reference_image_urls最多 30 张JPEG/PNG/WebP 等,单张小于 30 MB
reference_audio_urls最多 10 段WAV/MP3,需与参考视频一起用
duration4–30 的整数,或 -1 由模型决定,默认 5单位秒
resolution480p / 720p / 1080p,默认 480p
aspect_ratio16:9 4:3 1:1 3:4 9:16 21:9 adaptive竖屏直接写 9:16
generate_audio默认 true

算一下费用

计费秒数 = 参考视频总时长 + 输出时长。参考图和参考音频不额外收费。

参考 + 输出480p($0.1215/秒)720p($0.2715/秒)1080p($0.68/秒)
5 秒 + 4 秒$1.0935$2.4435$6.12
5 秒 + 5 秒$1.215$2.715$6.8
10 秒 + 10 秒$2.43$5.43$13.6

省钱的办法:把参考视频剪到只剩你需要的那段动作,再用 480p 调提示词,定稿后再出 720p 或 1080p。更细的账看 Seedance 2.5 API 价格。

上线前注意

  • 素材地址要能公开访问:参考视频要用可公开访问的 HTTPS 地址。
  • 用回调代替轮询:请求顶层加 "callback": {"url": "https://你的域名/hiapi/callback"},按 taskId 去重。
  • 及时转存:output[0].url 是临时链接,拿到后马上存到自己的存储。
  • 重试带幂等键:请求头加 Idempotency-Key,同一个键重试只创建一次任务。
  • 失败自动退款:只按成功生成的视频计费。

常见问题

没有参考视频,只有参考图能用吗?

不能,reference_video_urls 必填。只有图片的话,用 Seedance 2.5 图生视频 的参考图模式。

为什么扣费比我算的多?

参考视频的时长也计费。10 秒参考视频 + 5 秒输出,按 15 秒算。

能直接出竖屏吗?

能,aspect_ratio 写 9:16,模型直接按竖屏生成,不是事后裁切。

参考素材越多越贵吗?

参考图和参考音频不加钱,只有参考视频按时长计费。

没有参考素材、只想用一段文字出片,看 Seedance 2.5 文生视频 API。想先试一条,去模型页上传参考视频。

现在就用 HiAPI 生成

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

HiAPI Blog

相关文章

HiAPI

现在就用 HiAPI 生成

开始生成