FLUX 3.1 Image API
Black Forest Labs 的 FLUX3.1 Image 面向精细图像生成与迭代修改,支持参考图、蒙版编辑和最高16MP 输出。
FLUX3.1 Image 是 Black Forest Labs 提供的托管 API 图像模型,支持图像输入和图像输出,最高可输出16MP。模型面向迭代式制作与精准修图,支持以蒙版修改指定区域并保留周边画面,也可使用最多10 张参考图来维持不同场景中的构图或角色一致性。
它适合电商目录、虚拟试穿、概念艺术、故事板、主视觉和本地化广告等任务。提示词可使用十六进制颜色代码指定颜色,也可通过归一化边界框指示对象或编辑位置;可选的网络 grounding 能为地标、物种和物体等现实参考提供依据。模型还支持4K 输出,以及在文档规定范围内指定像素尺寸,尺寸无需为16 的倍数。
模型 ID
- 发布日期
- 上下文
- 46.864K
- 最大输出
- 42.177K
- 输入
- 文本 / 图像
- 输出
- 图像
核心要点
- 蒙版定点修改
- 最多10 张参考图
- 支持4K 输出
- 最高16MP 输出
- 可指定像素尺寸
供应商
比较不同供应商的调用价格,点击供应商可查看完整费用和适用条件。
| 可用率 | |
|---|---|
历史统计不等于实时健康检查,缺失数据不代表服务中断。
适合
快速开始
提交图片任务、轮询状态,再保存图片。以下示例使用 curl 和 Python 3(仅标准库,无需安装依赖)。
POST https://openapi.felo.ai/api/v1/images/generations
1填入 API key
从 Felo API Platform 账户创建 key,并设置为环境变量。
export FELO_API_KEY="YOUR_API_KEY"2发起第一次请求
可选参数的取值因模型而异,示例不预设这些值;添加前请在 Playground 确认。请求字段与 model、prompt 同级,不包在 input 中。
curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
-H "Authorization: Bearer $FELO_API_KEY" \
-H "Content-Type: application/json" \
-o created.json \
-d '{
"prompt": "A studio product photo of a ceramic coffee cup on warm linen, soft morning light",
"model": "flux-3-1-image"
}'3轮询任务
提交后获得 task_id;queued、running 时每 3 秒查询一次,succeeded、failed 或 interrupted 时停止。示例最多等待 30 分钟。保留 created.json 可继续查询同一任务,避免重复提交。
python3 - <<'PY'
import json, os, time
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen
task = json.loads(Path("created.json").read_text())
task_id = task["task_id"]
url = "https://openapi.felo.ai/api/v1/images/generations/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["FELO_API_KEY"]}
deadline = time.monotonic() + 1800
while task["status"] in ("queued", "running"):
if time.monotonic() >= deadline:
raise TimeoutError(f"Keep task_id={task_id} to resume polling")
time.sleep(3)
with urlopen(Request(url, headers=headers), timeout=60) as response:
task = json.load(response)
if task.get("task_id") != task_id or task.get("kind") != "image":
raise ValueError("Unexpected task response")
print(task["status"])
if task["status"] != "succeeded":
raise RuntimeError(task.get("error") or task["status"])
if not task.get("outputs"):
raise ValueError("Task succeeded without image outputs")
Path("task.json").write_text(json.dumps(task))
print("Saved task.json")
PY4下载输出
成功后从 task.json 读取 outputs 并保存。结果兼容 HTTPS 地址、URL 对象和 b64_json。签名地址请及时下载;下载图片时无需携带 API Key。
python3 - <<'PY'
import base64, json
from pathlib import Path
from urllib.request import urlopen
task = json.loads(Path("task.json").read_text())
if task.get("status") != "succeeded" or not task.get("outputs"):
raise ValueError("No completed image outputs")
extensions = {"image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif"}
for index, output in enumerate(task["outputs"], 1):
item = output if isinstance(output, dict) else {}
url = output if isinstance(output, str) else item.get("url") or item.get("unsigned_url")
mime = item.get("media_type") or "image/png"
if url and url.startswith("https://"):
with urlopen(url, timeout=60) as response:
data = response.read()
mime = response.headers.get_content_type()
elif url and url.startswith("data:image/") and ";base64," in url:
header, encoded = url.split(",", 1)
mime = header[5:].split(";", 1)[0]
data = base64.b64decode(encoded, validate=True)
elif item.get("b64_json"):
data = base64.b64decode(item["b64_json"], validate=True)
else:
raise ValueError("Unrecognized image output")
path = Path(f"image-{index}" + extensions.get(mime, ".bin"))
path.write_bytes(data)
print(path)
PYinput_references
编辑图片时,将示例地址替换为你的 HTTPS 图片地址或 base64 图片 data URL。提交一次后,沿用相同的轮询与保存步骤。
curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
-H "Authorization: Bearer $FELO_API_KEY" \
-H "Content-Type: application/json" \
-o created.json \
-d '{
"prompt": "Keep the product and framing. Replace the background with a sunlit marble countertop.",
"model": "flux-3-1-image",
"input_references": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/product.png"
}
}
]
}'支持的参数
- n
- seed
- quality
- resolution
- aspect_ratio
- output_format
- input_references
想查看完整文档?
API 文档 →常见问题
什么是 FLUX 3.1 Image?
FLUX3.1 Image 是 Black Forest Labs 提供的托管 API 图像模型,支持图像输入和图像输出,最高可输出16MP。模型面向迭代式制作与精准修图,支持以蒙版修改指定区域并保留周边画面,也可使用最多10 张参考图来维持不同场景中的构图或角色一致性。 它适合电商目录、虚拟试穿、概念艺术、故事板、主视觉和本地化广告等任务。提示词可使用十六进制颜色代码指定颜色,也可通过归一化边界框指示对象或编辑位置;可选的网络 grounding 能为地标、物种和物体等现实参考提供依据。模型还支持4K 输出,以及在文档规定范围内指定像素尺寸,尺寸无需为16 的倍数。
如何计算调用费用?
费用取决于你使用的供应商、对应价格和实际用量。长文本输入等情况可能适用不同价格,详见计费明细。 按实际生成费用计费,具体金额以账单为准。
支持哪些输入和输出?
支持图像输入和图像输出,最高可输出16MP。
上下文长度和输出长度是多少?
资料未提供上下文长度;输出上限为16MP。
它适合哪些任务?
适合电商目录、虚拟试穿、概念艺术、故事板、主视觉和本地化广告,也适用于需要精细修改的迭代制作。
它与同系列模型有什么区别?
资料没有提供 FLUX3 Image Klein 或 FLUX3 的具体能力对比。
相关模型
FLUX 3 Image Klein
Black Forest Labs图像flux-3-image-kleinFLUX 3 Image Klein 是 Black Forest Labs 推出的开源图像生成与编辑模型,支持文生图、单参考图编辑和多参考图合成。
输出
image
生成图像 · 基础费率
$0.009 / 1 张图像
FLUX 3 Image
Black Forest Labs图像flux-3-imageBlack Forest Labs 于 2026 年 7 月 23 日推出的 FLUX 3 系列图像生成与编辑模型,支持原生 4K 分辨率及像素级精确编辑。
输出
image
生成图像 · 基础费率
—