搜索

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

返回博客
教程3 分钟阅读

FLUX.3 视频 API 怎么用?文生、图生和视频续写中文教程

一个 flux-3 搞定三种用法,Draft 预览每秒 $0.09,curl 和 Python 示例、价格表和参数一览。

HiAPI 编辑部FLUX.3API 教程视频生成

TL;DR

  • FLUX.3 Video 是 Black Forest Labs 的视频模型,在 HiAPI 上只有一个模型名 flux-3,同时支持文生视频、图生视频(1–10 张关键帧)和视频续写,单条 5–20 秒,默认带同步声音。打开模型页 就能在线生成,新用户注册送 200 积分。
  • 按秒计费:720p 每秒 $0.25,1080p 每秒 $0.42;Draft 预览模式每秒只要 $0.09。5 秒 Draft 预览 $0.45。
  • 调提示词一定先开 draft: true:只有 prompt 一个必填项,不写别的参数也会按正式档扣费。

先看效果

模型页示例,720p、5 秒,带声音:

A silent maglev train glides through a vast solar-panel field at golden hour, reflective silver body catching warm directional light, low tracking shot alongside the train, distant maintenance drones crossing the sky, cinematic composition, rich cohesive color grade, premium commercial finish, subtle film grain, high dynamic range, smooth natural motion, stable cinematic camera movement, consistent lighting across frames

用这个提示词生成 →(5 秒、720p)

flux-3 模型页示例,720p,5 秒,带声音。按正式档算 $1.25,用 Draft 预览是 $0.45。

价格

模式720p / 秒1080p / 秒
正式生成(文生、图生)$0.25$0.42
Draft 预览$0.09不支持
视频续写(传 start_video)$0.59$0.76
Draft + 视频续写$0.18不支持

HiAPI 现价,2026 年 10 月 15 日核对。声音开不开不影响价格。

时长Draft 720p正式 720p正式 1080p
5 秒$0.45$1.25$2.10
10 秒$0.90$2.50$4.20
20 秒$1.80$5.00$8.40

推荐流程:Draft 把提示词和动作调对(每条 $0.45 起),定稿再用正式档出 720p 或 1080p。

curl:先跑一条 Draft

curl -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer $HIAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-3",
    "input": {
      "prompt": "一架纸飞机滑过洒满阳光的办公室,慢动作,镜头跟随",
      "duration": 5,
      "aspect_ratio": "16:9",
      "draft": true
    }
  }'

5 秒 Draft,$0.45。返回 taskId 后查结果:

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

status 为 success 后,从 output[0].url 下载视频,声音已经合在同一个 MP4 里。

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(timeout_s=900, **params):
    body = {"model": "flux-3", "input": 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)

# 定稿后出正式 1080p
url = generate(
    prompt="一架纸飞机滑过洒满阳光的办公室,慢动作,镜头跟随",
    duration=8, resolution="1080p", aspect_ratio="16:9",
)
with open("clip.mp4", "wb") as f:
    f.write(requests.get(url).content)

这条 8 秒 1080p,$3.36。

图生视频:1 张首帧,或最多 10 张关键帧

在 input 里加 images(不是 image_urls),按张数决定用法:

  • 1 张:首帧。
  • 2 张:首帧 + 尾帧,模型补中间的过渡。
  • 3–10 张:关键帧故事板,均匀分布在整条视频里。
{
  "model": "flux-3",
  "input": {
    "prompt": "从日出平滑过渡到霓虹闪烁的夜晚城市,镜头稳定",
    "images": [
      "https://your-cdn.example.com/start.webp",
      "https://your-cdn.example.com/end.webp"
    ],
    "resolution": "1080p",
    "duration": 8
  }
}

图片支持 PNG、JPEG、WebP。图生视频和文生视频同价。

视频续写:接着已有视频往下拍

传 start_video,模型会从这段视频的结尾继续生成:

{
  "model": "flux-3",
  "input": {
    "prompt": "镜头继续向前推进,列车驶入明亮的山间隧道",
    "start_video": "https://your-cdn.example.com/source.mp4",
    "duration": 5,
    "draft": true
  }
}
  • start_video 只支持 MP4,最长 15 秒,最大 50 MB。
  • images 和 start_video 不能同时传。
  • 续写单价更高:720p 每秒 $0.59,Draft 续写每秒 $0.18。

参数一览

参数取值说明
prompt字符串,必填场景、动作、运镜、对白和声音都写在这里
duration5–20 的整数,默认 5单位秒
resolution720p / 1080p,默认 720pDraft 只能 720p,Draft 配 1080p 会被拒绝
aspect_ratioauto 21:9 2:1 16:9 4:3 1:1 3:4 9:16,默认 auto
draft默认 false低价预览档
generate_audio默认 true关掉输出无声视频,价格不变
images最多 10 张图生视频
start_videoMP4 地址视频续写

上线前注意

  • 用回调代替轮询:请求顶层(和 input 同级)加 "callback": {"url": "https://你的域名/hiapi/callback"},按 taskId 去重。
  • 及时转存:output[0].url 是临时链接,拿到后马上存到自己的存储。
  • 重试带幂等键:请求头加 Idempotency-Key,同一个键重试只创建一次任务,不会重复扣费。
  • 失败自动退款:只按成功生成的视频计费。

常见问题

一条最长多久?

20 秒。要更长,用视频续写接着往下生成。

声音能关吗?关了便宜吗?

能,generate_audio: false。价格只看分辨率、Draft 和是否续写,关声音不会变便宜。

Draft 和正式档差多少?

720p 每秒 $0.09 对 $0.25,Draft 便宜约 64%,生成也更快,适合调提示词。

模型名为什么没有 /text-to-video 后缀?

FLUX.3 把文生、图生、续写合在一个 flux-3 里,靠传不传 images、start_video 区分。

想先试一条,去模型页生成。更多视频模型的价格对比,看定价页。

现在就用 HiAPI 生成

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

HiAPI Blog

相关文章

HiAPI

现在就用 HiAPI 生成

开始生成