
flux-kontext
使用 RunComfy 上的 Flux 1 Kontext Pro(Black Forest Labs 的精确局部图像编辑模型)编辑图像——该技能捆绑了模型文档中记录的提示模式,因此比直接使用同一模型进行提示获得更清晰的结果。记录了 Flux Kontext 的优势(单参考精确局部编辑、强大的提示控制、一致的高保真输出)、模式(单图像 + 提示),以及何时改用 Nano Banana Edit / GPT Image 2 edit / Flux 2 Klein。通过本地 RunComfy CLI 调用 `runcomfy run blackforestlabs/flux-1-kontext/pro/edit`。触发词为“flux kontext”、“flux-kontext”、“flux 1 kontext”、“kontext”、“BFL kontext”或任何明确要求使用此模型进行编辑的请求。
Edit images with Flux 1 Kontext Pro (Black Forest Labs' precise local image-edit model) on RunComfy — bundled with the model's documented prompting patterns so the skill gets sharper output than naive prompting against the same model. Documents Flux Kontext's strengths (single-reference precise local edits, strong prompt control, consistent high-fidelity outputs), the schema (single image + prompt), and when to route to Nano Banana Edit / GPT Image 2 edit / Flux 2 Klein instead. Calls `runcomfy run blackforestlabs/flux-1-kontext/pro/edit` through the local RunComfy CLI. Triggers on "flux kontext", "flux-kontext", "flux 1 kontext", "kontext", "BFL kontext", or any explicit ask to edit with this model.
Flux Kontext Pro — Pro Pack on RunComfy
runcomfy.com · 模型页面 · GitHub
Black Forest Labs 的 Flux 1 Kontext Pro —— 单参考精确局部图像编辑 —— 托管在 RunComfy Model API 上。强大的提示控制、一致的输出、高保真度。
npx skills add agentspace-so/runcomfy-skills --skill flux-kontext -g
何时选择此模型(与同类模型对比)
| 您想要 | 使用 |
|---|---|
| 单图像精确局部编辑(“她现在拿着X”) | Flux Kontext |
| 高保真保留源身份 | Flux Kontext |
| 批量编辑1–20张图像 | Nano Banana Edit |
| 编辑图像中的多语言/嵌入文本 | GPT Image 2 edit |
| 从零生成,无源图像 | Flux 2 Klein |
如果用户明确提到“Flux Kontext”/“kontext”/“BFL Kontext”,则无论其他情况都路由到此模型。
前提条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy 账户 —
runcomfy login会打开浏览器设备码流程。 - CI / 容器 — 设置
RUNCOMFY_TOKEN=<token>代替runcomfy login。
端点 + 输入模式
blackforestlabs/flux-1-kontext/pro/edit
| 字段 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
prompt |
string | 是 | — | 单个声明式编辑指令。 |
image |
string | 是 | — | 单个源图像 URL(可公开获取的 HTTPS)。 |
aspect_ratio |
enum | 否 | (输入) | 从模型页面支持的宽高比中选择。 |
seed |
int | 否 | — | 重复使用以进行变体比较。 |
该模式有意保持最小化 —— Kontext 依赖于提示 + 单个参考。对于多图像或基于网络的编辑,请路由到 Nano Banana Edit。
如何调用
默认 —— 局部编辑,保留其他所有内容:
runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep the person'\''s face, pose, and clothing unchanged. Add an orange umbrella in her left hand and a slight smile.",
"image": "https://.../portrait.jpg"
}' \
--output-dir <绝对路径>
使用种子进行可重复的变体系列:
runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep the bottle, label, and lighting unchanged. Replace the brand text on the label from \"ALPHA\" to \"AURA\".",
"image": "https://.../bottle.jpg",
"seed": 42
}' \
--output-dir <绝对路径>
提示 —— 实际有效的方法
单个声明式指令。 Kontext 在类似文档示例的提示上表现出色:"She is now holding an orange umbrella and smiling"。祈使语气,单一更改。
先保留。 以 "Keep [identity / pose / framing / brand] unchanged." 开头。然后进行更改。模型会优先考虑前面陈述的内容。
仅单个参考 —— 选择正确的那个。 这里没有多图像扇出。如果您有多个参考,请决定哪个是主要的并传递该参考。对于多图像流程,请路由到 Nano Banana Edit。
小更改迭代。 如果 Kontext 出现偏差,将复合编辑拆分为顺序的单个指令传递(传递1:更改背景,传递2:更改服装)。
宽高比 —— 从支持的枚举中选择。 列表外的值会报错或裁剪。
反模式:
- 复合提示(“更改A并添加B并移除C”)→ 偏差。
- 尝试扇出到多个源图像 → 错误的模型(使用 Nano Banana Edit)。
- 使用被动语态的提示 → 可靠性较低。
- 在没有源图像的情况下要求新颖构图 → 错误的模型(使用 Flux 2 Klein t2i)。
优势场景
| 用例 | 为什么选择 Flux Kontext |
|---|---|
| 单次精确局部编辑 | 专为此设计;高保真度 |
| 通过目标更改保留源身份 | 在明确指令下强保留 |
| 品牌资产文本或颜色替换 | 引用文本 + 保留引导效果良好 |
| 单张图像的快速迭代 | 短提示 + 单个参考 = 快速结果循环 |
示例提示(已验证可产生强结果)
页面示例:
She is now holding an orange umbrella and smiling
保留引导的品牌编辑:
Keep the bottle silhouette, table, and lighting exactly as in the input.
Replace only the brand text on the label, from "ALPHA" to "AURA".
Same font weight, white on black, centered.
构图微编辑:
Keep the person's face, pose, and clothing unchanged. Add a leather
shoulder bag, dark brown, hanging on the right shoulder.
限制
- 仅单个源图像。 对于多图像流程,请使用 Nano Banana Edit(1–20)。
- RunComfy 公开文档较少 —— 除 prompt + image + aspect_ratio + seed 之外的模式字段可能存在;请查看模型页面以获取最新字段列表。
- 复合提示会偏差 —— 拆分为顺序传递。
- 对于多语言/嵌入文本编辑,GPT Image 2 edit 通常更胜一筹。
退出码
| 码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI 参数错误 |
| 65 | 输入 JSON 错误 / 模式不匹配 |
| 69 | 上游 5xx |
| 75 | 可重试:超时 / 429 |
| 77 | 未登录或令牌被拒绝 |
完整参考:docs.runcomfy.com/cli/troubleshooting。
工作原理
该技能使用与模式匹配的 JSON 主体调用 runcomfy run blackforestlabs/flux-1-kontext/pro/edit。CLI 向 https://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit 发送 POST 请求,轮询请求,获取结果,并将任何 .runcomfy.net/.runcomfy.com URL 下载到 --output-dir。Ctrl-C 在退出前取消远程请求。
安全与隐私
- 令牌存储:
runcomfy login将 API 令牌写入~/.config/runcomfy/token.json,权限为 0600(仅所有者读写)。在 CI/容器中设置RUNCOMFY_TOKEN环境变量以完全绕过文件。 - 输入边界:用户提示通过
--input作为 JSON 字符串传递给 CLI。CLI 不会对提示进行 shell 扩展;它直接将 JSON 主体通过 HTTPS 传输到 Model API。提示内容无 shell 注入风险。 - 第三方内容:您传递的图像/蒙版/视频 URL 由 RunComfy 模型服务器获取,而非您机器上的 CLI。将外部 URL 视为不受信任;基于图像的提示注入是任何图像编辑/视频编辑模型的已知风险。
- 出站端点:仅
model-api.runcomfy.net(请求提交)和*.runcomfy.net/*.runcomfy.com(生成输出的下载白名单)。无遥测,无回调。 - 生成文件大小上限:CLI 会中止任何超过 2 GiB 的单个下载,以防止恶意或失控模型输出导致磁盘填满。





