搜索

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

返回博客
教程3 分钟阅读

FLUX 3 Max API 怎么用?5 分钟跑通第一条视频

在线试用 4 步、API 接入 4 步,附可运行的 curl 和 Python、图生视频与关键帧示例。

HiAPI 编辑部FLUX 3 Max视频 APIAPI 接入教程

TL;DR

  • 它是什么:Black Forest Labs 的 FLUX 3 Max,最长 20 秒、原生带音频的视频模型。HiAPI 把它拆成 flux-3-max/text-to-video、flux-3-max/image-to-video、flux-3-max/keyframes-to-video 三个模型 ID,打开模型页 输入提示词就能生成。新用户注册送 200 积分(约 $0.10),一条 5 秒 720p 需要 608 积分,试玩前记得先充值。
  • 多少钱:按输出秒数计费,720p $0.0608/秒、1080p $0.1036/秒。5 秒 720p 是 $0.304,$10 能出约 32 条;generate_audio 不影响价格,失败任务不扣费。
  • 最快怎么调:POST https://api.hiapi.ai/v1/tasks,model 写 flux-3-max/text-to-video,input 里给 prompt,拿到 taskId 后查询,下载 data.output[0].url。

FLUX 3 Max 是什么,适合做什么

  • 最长 20 秒。 duration 取 5–20 的整数秒,默认 5 秒,一条任务直接出完整片段。
  • 8 种画幅。 auto、21:9、2:1、16:9、4:3、1:1、3:4、9:16,默认 auto,横屏、竖屏、方图不用二次裁切。
  • 原生同步音频。 generate_audio 默认开启,海浪、脚步、环境声跟画面一起出,不加价。
  • 关键帧按帧号定位。 1–10 张图放在 24fps 时间轴上,指定什么时刻出现什么画面。
  • 三个入口,一套接口。 纯文本、首帧图、关键帧各一个模型 ID,请求都发到 /v1/tasks,切换只改 model 和一个输入字段。

适合产品广告、社媒短视频、分镜预演,以及需要精确转场的图生视频。分辨率有 720p 和 1080p 两档,需要 4K 时选支持 4K 的模型。

三种模式共用 prompt、duration、resolution、aspect_ratio、generate_audio、reasoning_level 这一组参数。先把文生视频的提示词调顺,再换到图生视频或关键帧,参数不用重学。

在线试用:4 步出第一条

  1. 打开 FLUX 3 Max 文生视频模型页,或点本文代码块下方的"用这个提示词生成",提示词会自动填好。
  2. 注册或登录。新账号自带 200 积分,够熟悉界面;正式生成前先充值,5 秒 720p 一条 608 积分。
  3. 选 5 秒、720p、16:9。第一次对比提示词可以把 generate_audio 关掉,画面差异更容易判断。
  4. 点生成,任务完成后直接下载。

API 接入:4 步

  1. 在 HiAPI 控制台 创建 API Key(sk-...)。
  2. POST /v1/tasks 创建任务,model 选三个 ID 之一,input 至少给 prompt。
  3. 用 GET /v1/tasks/{taskId} 查询,或在请求里带 callback.url 等通知。
  4. status 变成 success 后,从 data.output[0].url 下载视频。

reasoning_level 可选 low 或 high,默认 high;想快速对比几条提示词时切到 low,定稿再换回来。5 秒 720p 一条 $0.304,$10 能跑约 32 条。

文生视频:curl 版

curl -s -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-3-max/text-to-video",
    "input": {
      "prompt": "A slow aerial shot of ocean waves breaking on black volcanic rock at sunrise, warm golden light, sea spray catching the sun, natural ocean sound and distant gulls",
      "duration": 5,
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "generate_audio": true,
      "reasoning_level": "high"
    }
  }'

返回的任务 ID 在 data.taskId:

{"code":200,"data":{"taskId":"tk-hiapi-..."},"message":"success"}

提示词单独一条,复制后可直接粘贴到 input.prompt:

A slow aerial shot of ocean waves breaking on black volcanic rock at sunrise, warm golden light, sea spray catching the sun, natural ocean sound and distant gulls

用这个提示词生成 →

画幅选 16:9、时长 5 秒,打开音频,同一条海浪镜头就能在模型页复现。

文生视频:Python 版

创建、轮询、下载一次写完,换上自己的 Key 就能跑:

import time, requests

API = "https://api.hiapi.ai/v1/tasks"
HEADERS = {"Authorization": "Bearer sk-YOUR_KEY"}

payload = {
    "model": "flux-3-max/text-to-video",
    "input": {
        "prompt": "A slow aerial shot of ocean waves breaking on black volcanic rock at sunrise, warm golden light, sea spray catching the sun, natural ocean sound and distant gulls",
        "duration": 5,
        "resolution": "720p",
        "aspect_ratio": "16:9",
        "generate_audio": True,
        "reasoning_level": "high",
    },
}

resp = requests.post(API, headers=HEADERS, json=payload, timeout=30)
task_id = resp.json()["data"]["taskId"]

while True:
    data = requests.get(f"{API}/{task_id}", headers=HEADERS, timeout=30).json()["data"]
    if data["status"] in ("success", "fail"):
        break
    time.sleep(5)

if data["status"] == "success":
    video_url = data["output"][0]["url"]
    with open("flux-3-max.mp4", "wb") as f:
        f.write(requests.get(video_url, timeout=120).content)
else:
    print(data.get("error"))

图生视频:加一个 image_url

把 model 换成 flux-3-max/image-to-video,input 加 image_url(必填,首帧)。要固定结尾就再加 end_image_url(可选,末帧):

curl -s -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-3-max/image-to-video",
    "input": {
      "prompt": "Morning mist drifts over the harbor; the boats rock gently and the camera slowly pushes forward",
      "image_url": "https://static.hiapi.ai/your-first-frame.jpg",
      "end_image_url": "https://static.hiapi.ai/your-last-frame.jpg",
      "duration": 5,
      "resolution": "720p"
    }
  }'

关键帧生视频:用 frame_index 排时间轴

model 换成 flux-3-max/keyframes-to-video,input 给 keyframes[]:1–10 项,每项一个 image_url 和一个 frame_index。帧号按 24fps 计算,最大值是 duration × 24,同一请求里不能重复。5 秒视频的有效范围是 0–120:

curl -s -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-3-max/keyframes-to-video",
    "input": {
      "prompt": "A continuous cinematic morph from a misty harbor into a close-up of an iced matcha latte",
      "keyframes": [
        {"image_url": "https://static.hiapi.ai/frame-0.jpg", "frame_index": 0},
        {"image_url": "https://static.hiapi.ai/frame-120.jpg", "frame_index": 120}
      ],
      "duration": 5,
      "resolution": "720p"
    }
  }'

提交前先自己核对帧号范围和唯一性:超出 duration × 24 或两项同帧,任务会在异步阶段失败。

上线前注意这 3 件事

  1. 任务异步,用回调更省事。 请求里带 callback.url 和 when: "final",结束自动通知;轮询就设超时,并先把 taskId 存下来,进程崩了也不用重新提交。
  2. 结果 URL 会过期。 任务成功后立刻下载 data.output[0].url,存文件本身,别把链接当长期地址。批量任务里把失败项单独记下来重试,不要整批重发。
  3. 每个请求显式写 resolution。 分辨率直接决定单价,写死在请求里账单才可预期;generate_audio 只影响有没有声音,不影响价格。

常见问题

三个模型 ID 怎么选? 只有文字用 flux-3-max/text-to-video;有一张首帧图用 flux-3-max/image-to-video;要在中间多个时刻精确切画面,用 flux-3-max/keyframes-to-video。

加音频要多付钱吗? 不用。价格只按输出秒数和分辨率计算,generate_audio 开或关都一样,失败任务不扣费。

关键帧最多放几个,frame_index 怎么算? 1–10 个。帧号是 24fps 时间轴上的位置,从 0 开始,最大到 duration × 24;5 秒是 120,10 秒是 240,20 秒是 480,同一请求内不能重复。

能出多长、什么分辨率的视频? duration 5–20 的整数秒,默认 5;resolution 720p 或 1080p,默认 720p。画幅 8 种,默认 auto。

复制上面的海浪提示词,去模型页生成第一条 5 秒 720p 视频,画幅选 16:9,点一下就是同款镜头。

现在就用 HiAPI 生成

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

HiAPI Blog

相关文章

HiAPI

现在就用 HiAPI 生成

开始生成