FLUX.1 Kontext 是支持图片编辑和文生图的上下文感知模型系列,提供 Pro 与 Max 两个版本、可预测的按张计费和异步任务处理。
服务亮点

Image link valid for 72 hours
透明定价,无隐藏费用。按量付费,用多少付多少。
| 型号 | 黄金价当前价格 | 铂金价 | 钻石价 | 官方价 | 为你节省 |
|---|---|---|---|---|---|
flux-kontext-pro | 0.32Credits(~$0.032)/张 | 0.304Credits(~$0.0304)/张 | 0.288Credits(~$0.0288)/张 | 0.4Credits(~$0.04)/张 | 20% |
flux-kontext-max | 0.64Credits(~$0.064)/张 | 0.608Credits(~$0.0608)/张 | 0.576Credits(~$0.0576)/张 | 0.8Credits(~$0.08)/张 | 20% |
* 实际费用以最终输出为准。
一次 POST 请求即可调用 flux-kontext-pro。生成为异步任务:先提交任务,再轮询任务接口获取图片链接。
把 APIMart Key 保存到环境变量 APIMART_API_KEY,每个请求都带上 Authorization: Bearer <key>。
向 POST /v1/images/generations 提交 model flux-kontext-pro、提示词和 size。编辑时传 image_urls,最多 4 张参考图。示例里的 example.com 地址只是占位,请换成你自己可公开访问的图片 URL 或 Base64。任务 ID 在 data[0].task_id。
轮询 GET /v1/tasks/{task_id},状态为 completed 后从 data.result.images[0].url[0] 读取图片链接。结果保留 72 小时,请及时下载需要保存的图片。
全部参数、输出尺寸与返回字段见 FLUX.1 Kontext API 文档。
curl -X POST https://api.apimart.ai/v1/images/generations \
-H "Authorization: Bearer $APIMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-kontext-pro",
"prompt": "温馨的阅读角,绿色扶手椅,暖色台灯,窗外下着雨",
"size": "4:3",
"output_format": "png"
}'import os
import time
import requests
API_BASE = "https://api.apimart.ai"
headers = {"Authorization": f"Bearer {os.environ['APIMART_API_KEY']}"}
# 1. Submit the generation task
payload = {
"model": "flux-kontext-pro",
"prompt": "温馨的阅读角,绿色扶手椅,暖色台灯,窗外下着雨",
"size": "4:3",
"output_format": "png"
}
resp = requests.post(f"{API_BASE}/v1/images/generations", headers=headers, json=payload, timeout=60)
resp.raise_for_status()
task_id = resp.json()["data"][0]["task_id"]
# 2. Poll the task until it finishes
for _ in range(200):
task_resp = requests.get(f"{API_BASE}/v1/tasks/{task_id}", headers=headers, timeout=30)
task_resp.raise_for_status()
task = task_resp.json()["data"]
if task["status"] == "completed":
print(task["result"]["images"][0]["url"][0])
break
if task["status"] == "failed":
raise RuntimeError(task.get("error", {}).get("message", "generation failed"))
time.sleep(3)
else:
raise TimeoutError(f"task {task_id} did not finish in time; continue GET polling with this task ID")curl -X POST https://api.apimart.ai/v1/images/generations \
-H "Authorization: Bearer $APIMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-kontext-pro",
"prompt": "把夹克换成深红色皮夹克,人物面部、姿势和背景保持不变",
"size": "auto",
"output_format": "png",
"image_urls": [
"https://example.com/portrait.jpg"
]
}'TASK_ID="task_xxx" # replace with the task_id returned by the POST request
curl "https://api.apimart.ai/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $APIMART_API_KEY"| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
model | string | 是 | 默认值: flux-kontext-pro | flux-kontext-pro 或 flux-kontext-max。 |
prompt | string | 是 | 默认值: — | 描述要生成的图片,或要对参考图做的修改。 |
image_urls | string[] | 否 | 默认值: — | 最多 4 张参考图,公开 URL 或 Base64。文生图时不传。 |
size | string | 否 | 默认值: 1:1 | 1:1、4:3、3:4、16:9、9:16、3:2、2:3、21:9、9:21 或 auto。输出约 1 MP:传 width 或 height 会导致任务失败,resolution 不生效。 |
output_format | string | 否 | 默认值: png | png、jpeg 或 webp。 |
seed | integer | 否 | 默认值: — | 使用相同 seed 和输入有助于复现结果;不传则随机。 |
prompt_upsampling | boolean | 否 | 默认值: false | 生成前由模型扩写并改写提示词。 |
safety_tolerance | integer | 否 | 默认值: 2 | 0(最严格)到 6。 |
nsfw_check | boolean | 否 | 默认值: false | 提交前用 omni-moderation-latest 审核提示词和输入图片。 |
一个 APIMart API Key 即可调用下表所有 FLUX 模型。图片模型按张计费,FLUX 3 Video 按视频秒数计费。
| 模型 | 适合场景 | 输出 |
|---|---|---|
| FLUX 3 Image API | 图片方向的 FLUX 3 API:文生图与编辑,最多 10 张参考图,支持搜索增强,最高 4K 输出 | 768sq 至 4K(约 16 MP) |
| FLUX 3 Image Klein API | 成本更低的 FLUX 3 图片,可设 seed、1–16 步,输出 PNG 或 JPEG | 768sq 至 4K(约 16 MP) |
| FLUX 3 Video API | 文生视频、1–10 张关键帧、视频续写与草稿,自带同步音频 | HD 或 FHD,5–20 秒 |
| FLUX.2 API | 在一个页面里比较 FLUX.2 Pro、Max 与 Flex | 1–4 MP |
| FLUX.2 Pro API | 兼顾质量与成本的生产级图片,最多 8 张参考图 | 1–4 MP |
| FLUX.2 Max API | FLUX.2 系列最高画质,最多 8 张参考图 | 1–4 MP |
| FLUX.2 Flex API | 可调 steps 与 guidance,适合文字排版和版式设计 | 1–4 MP |
| FLUX.1 Kontext API当前页面 | 在一个页面里比较 FLUX.1 Kontext Pro 与 Max | 约 1 MP |
| FLUX.1 Kontext Pro API | 上下文感知编辑,每张固定价格,最多 4 张参考图 | 约 1 MP |
| FLUX.1 Kontext Max API | 画质更高、更贴合提示词的 Kontext 编辑 | 约 1 MP |
来自 APIMart 博客的教程、对比与价格分析。
以图片编辑为核心,提供明确的输出控制和统一异步流程
需要视觉上下文时传参考图,也可不传参考图直接文生图
创建账号、完成鉴权,然后提交并轮询统一图片任务
登录 APIMart 并为余额充值;同一余额可用于平台支持的多个模型。
在控制台创建密钥,并在 Authorization 请求头中以 Bearer Token 方式发送。
向 /v1/images/generations 发送 POST 请求,读取 data[0].task_id,再轮询 /v1/tasks/{task_id},直至 completed 或 failed。
模型选择、输入、控制参数、计费和任务行为说明
FLUX.1 Kontext 是 Black Forest Labs 的上下文感知图片模型系列,主要用于根据文本指令编辑图片,也支持纯文生图。
两者都支持文生图和参考图编辑,最多 4 张参考图,输出约 1 MP。flux-kontext-pro 成本更低,适合日常编辑;flux-kontext-max 画质更高、更贴合提示词,单张价格是 Pro 的 2 倍。耗时因任务和负载而异。
Black Forest Labs 于 2025 年 5 月 29 日发布 FLUX.1 Kontext,包括 [pro] 和 [max] 两个模型。在 APIMart 上分别用 flux-kontext-pro 和 flux-kontext-max 调用。
image_urls 最多可传四个 URL,输出图与全部参考图的总像素不得超过 9MP。多参考图属于实验性能力,并且每个 URL 都必须能从公网直接访问。
Kontext 输出恒约 1MP,resolution 不生效,传入 width 或 height 会被拒绝。size 可填写九种支持比例之一,也可填写 WIDTHxHEIGHT 像素串;像素串会换算为最接近的支持比例。16:9 与 9:16 的实际输出比例可能偏差约 4%。
通过 output_format 选择 png、jpeg 或 webp。seed 为可选参数,默认随机;在输入相同的情况下复用固定 seed,有助于复现结果。
可能会。实测中,即使没有显式开启 prompt_upsampling,flux-kontext-max 也扩写了提示词。若必须严格保持原始措辞,请将提示词改写视为可能行为并检查输出。
提交生成请求后,使用返回的 task_id 轮询,直到 completed 或 failed。失败任务会自动退款。参考图 URL 必须公网可达;会拦截数据中心流量的图床可能导致抓取失败,建议使用稳定的公网地址。
FLUX.1 Kontext API 按生成图片张数计费。APIMart 原价(2026 年 10 月):flux-kontext-pro 每张 $0.04,flux-kontext-max 每张 $0.08,宽高比和参考图数量不加价。黄金会员价为 $0.032 和 $0.064,铂金和钻石会员最高省 28%。失败任务会退款,最终扣费以完成任务的 cost 为准。
注册 APIMart 账号后,在控制台的 API Keys 页面创建密钥即可。同一个 Key 可以调用 Black Forest Labs FLUX.1 Kontext API 以及平台上的全部模型,按量付费,无需订阅。
将 APIMart API Key 作为 Bearer Token 放入请求头,向 /v1/images/generations 发送 POST 请求,model 设为 flux-kontext-pro 或 flux-kontext-max,并传入提示词和可选的 image_urls。从响应中读取 data[0].task_id,轮询 /v1/tasks/{task_id} 直到任务变为 completed 或 failed。Flux Kontext API 的完整参数和代码示例见 APIMart 文档(docs.apimart.ai)。
不是。FLUX.1 Kontext API 在 APIMart 上没有免费额度,按量付费、按生成图片张数计费,失败任务自动退款。黄金会员享 8 折(立省 20%),铂金、钻石会员最高立省 28%。Pro 与 Max 的实时价格请查看本页价格表。
APIMart 用同一个 API Key 提供 Black Forest Labs 的三个模型系列:FLUX 3 Image(flux-3-image)和 FLUX 3 Image Klein(flux-3-image-klein)支持最多 10 张参考图的生成与编辑;FLUX.2(flux-2-pro、flux-2-max、flux-2-flex)支持最多 8 张参考图的生成与编辑;FLUX.1 Kontext(flux-kontext-pro、flux-kontext-max)专注上下文感知编辑。图片模型都使用 POST /v1/images/generations,FLUX 3 Video(flux-3-video)使用 POST /v1/videos/generations。
想要每张固定价格的快速上下文编辑,选 FLUX.1 Kontext:输出约 1 MP,最多 4 张参考图。FLUX.2 Pro、Max、Flex 最高 4 MP,最多 8 张参考图,按像素档位计费。FLUX 3 Image 最多 10 张参考图,最高 4K 输出,按分辨率计费。三者都用同一个 APIMart Key,本页对比表链接到各个模型。
探索同类型的其他模型。

MiniMax H3 Image
Built for image quality and prompt adherence. It handles text-to-image, reference-based generation and image editing. MiniMax says it can generate a 4K (4096 × 4096) image in under 10 seconds and work with up to 16 reference images. In Chinese launch coverage, MiniMax puts its speed at about 1.5 to 2 times that of mainstream tools.

MiniMax H3 Image Highspeed
Built for speed. The same coverage puts it at about 3 to 4 times faster than mainstream tools, which suits batch jobs or anything that needs fast turnaround.

Seedream 5.5
Seedream 5.5 brings your imagination to life through expressive visuals. From dreamy illustrations to cinematic scenes and product concepts, explore color, texture, and light to shape images that tell your story.

GPT Image 2.6 Sunburst
GPT Image 2.6 Sunburst brings a fresh burst of creativity to your ideas. From vibrant illustrations to atmospheric scenes and striking product concepts, explore rich colors, expressive lighting, and thoughtful compositions that make your vision shine.