跳转到内容
中文

FLUX 1.1 Pro

POST /v1/tasks

所有模型都通过 统一异步接口 POST /v1/tasks 调用,区别只在 input 字段(见下方 input 参数)。

模型概览

模型名称 flux-1.1-pro
类型 图像生成
接口 POST /v1/tasks
价格 HiAPI 定价

FLUX 1.1 Pro 适合写实图像、商业海报、产品图和摄影感场景,并支持可选参考图引导。

生产建议

生产环境建议
  • 生产环境建议在请求体顶层传 callback.url,让 HiAPI 在任务进入终态时主动通知你的服务,减少无效轮询。
  • GET /v1/tasks/:id 更适合本地调试、低频任务,或作为回调失败后的补偿查询。
  • callback.when 当前建议固定为 final;success 和 fail 都可能触发终态通知,你的服务端需要按 taskId 做幂等处理。

适用场景

写实产品图

适合摄影感产品、静物和商业素材。

promptaspect_ratio
参考图引导

可以传 image_prompt 让画面参考已有素材。

image_prompt
自定义尺寸

选择 custom 后用 width 和 height 指定尺寸。

aspect_ratiowidthheight
输出质量控制

适合按格式和质量做交付优化。

output_formatoutput_quality

请求参数

model string 必填

固定填 flux-1.1-pro。

示例 flux-1.1-pro
input object 必填

业务参数对象;写实图像控制参数都放在这里。

prompt string 必填

图像生成提示词。

image_prompt string 可选

可选参考图 URL,支持 jpeg、png、gif、webp。不支持 SVG。

aspect_ratio enum 可选

输出图像比例;选择 custom 时才使用 width 与 height。

默认 1:1 可选值: custom1:116:93:22:34:55:49:163:44:3
width integer 可选

自定义宽度,仅 aspect_ratio=custom 时使用;范围 256-1440。

height integer 可选

自定义高度,仅 aspect_ratio=custom 时使用;范围 256-1440。

safety_tolerance integer 可选

安全容忍度,1 最严格,6 最宽松。

默认 2
seed integer 可选

随机种子,用于复现结果。

prompt_upsampling boolean 可选

是否自动增强提示词。

默认 false
output_format enum 可选

输出格式。

默认 webp 可选值: webpjpgpng
output_quality integer 可选

输出质量,0-100;对 png 不相关。

默认 80
callback object 可选

可选回调配置;生产环境建议传 callback.url,让 HiAPI 在任务进入终态时主动通知你的服务。

url string 必填

接收任务终态通知的 HTTPS 地址。

示例 https://your-domain.com/hiapi/callback
when enum 可选

回调触发时机;当前建议固定为 final。

默认 final 可选值: final

用例示例

基础写实图

写实风格产品或静物图。

请求体
{
  "model": "flux-1.1-pro",
  "input": {
    "prompt": "A small red apple on a white table",
    "aspect_ratio": "1:1",
    "output_format": "webp",
    "output_quality": 80,
    "prompt_upsampling": false,
    "safety_tolerance": 2
  }
}
自定义尺寸

只有 aspect_ratio=custom 时才传 width 和 height。

请求体
{
  "model": "flux-1.1-pro",
  "input": {
    "prompt": "A realistic hero image of a glass bottle on a metal table",
    "aspect_ratio": "custom",
    "width": 1024,
    "height": 768,
    "output_format": "jpg",
    "output_quality": 85
  }
}

获取结果

  1. 提交成功后立即返回 taskId(不等待生成完成)。
  2. 生产环境优先等待 callback.url 收到终态通知;本地调试时可轮询 GET /v1/tasks/:id。
  3. status=success 后,从返回的 output[].url 下载生成的图片。
  4. 如果 status=fail,按返回的错误信息修正请求,不要盲目重试同一个无效请求。

下一步