flux-kontext
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFlux Kontext Pro — Pro Pack on RunComfy
Flux Kontext Pro — Pro Pack on RunComfy
Black Forest Labs' Flux 1 Kontext Pro — single-reference precise local image edit — hosted on the RunComfy Model API. Strong prompt control, consistent outputs, high fidelity.
bash
npx skills add agentspace-so/runcomfy-skills --skill flux-kontext -gBlack Forest Labs推出的Flux 1 Kontext Pro——支持单参考精准局部图像编辑——托管在RunComfy Model API上。具备强大的提示词控制能力、输出稳定、高保真度。
bash
npx skills add agentspace-so/runcomfy-skills --skill flux-kontext -gWhen to pick this model (vs siblings)
何时选择该模型(对比同类模型)
| You want | Use |
|---|---|
| Single-image precise local edit ("she's now holding X") | Flux Kontext |
| High-fidelity preservation of source identity | Flux Kontext |
| Batch edits across 1–20 images | Nano Banana Edit |
| Edit multilingual / embedded text in image | GPT Image 2 edit |
| Generate from scratch, no source image | Flux 2 Klein |
If the user said "Flux Kontext" / "kontext" / "BFL Kontext" explicitly, route here regardless.
| 需求场景 | 推荐模型 |
|---|---|
| 单张图片精准局部编辑(如“让她拿着X”) | Flux Kontext |
| 高保真保留源图主体特征 | Flux Kontext |
| 批量编辑1–20张图片 | Nano Banana Edit |
| 编辑图片中的多语言/嵌入文本 | GPT Image 2 edit |
| 从零生成图片,无需源图 | Flux 2 Klein |
如果用户明确提到“Flux Kontext” / “kontext” / “BFL Kontext”,无论场景如何都应使用此模型。
Prerequisites
前置条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy account — opens a browser device-code flow.
runcomfy login - CI / containers — set instead of
RUNCOMFY_TOKEN=<token>.runcomfy login
- RunComfy CLI — 执行安装
npm i -g @runcomfy/cli - RunComfy账号 — 执行会打开浏览器设备码验证流程。
runcomfy login - CI/容器环境 — 设置环境变量替代
RUNCOMFY_TOKEN=<token>登录。runcomfy login
Endpoints + input schema
接口端点 + 输入格式
blackforestlabs/flux-1-kontext/pro/edit
blackforestlabs/flux-1-kontext/pro/editblackforestlabs/flux-1-kontext/pro/edit
blackforestlabs/flux-1-kontext/pro/edit| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| string | yes | — | Single declarative edit instruction. |
| string | yes | — | Single source image URL (publicly fetchable HTTPS). |
| enum | no | (input) | Pick from supported W:H options on the model page. |
| int | no | — | Reuse for variant comparisons. |
The schema is intentionally minimal — Kontext leans on prompt + single ref. For multi-image or web-grounded edits, route to Nano Banana Edit.
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | — | 单个陈述式编辑指令。 |
| string | 是 | — | 单个源图的可公开访问HTTPS URL。 |
| enum | 否 | (输入图比例) | 从模型页面支持的宽高比选项中选择。 |
| int | 否 | — | 重复使用以对比不同变体结果。 |
该格式刻意简化——Kontext主要依赖提示词+单张参考图。如需多图或基于网络的编辑,请使用Nano Banana Edit。
How to invoke
调用方式
Default — local edit, preserve everything else:
bash
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 <absolute/path>With seed for reproducible variant series:
bash
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 <absolute/path>默认用法——局部编辑,保留其他所有内容:
bash
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 <absolute/path>使用seed生成可复现的系列变体:
bash
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 <absolute/path>Prompting — what actually works
提示词技巧——有效方法
One declarative instruction. Kontext shines on prompts shaped like the docs example: . Imperative mood, single change.
"She is now holding an orange umbrella and smiling"Preservation first. Lead with Then the change. Models honor what's stated up front.
"Keep [identity / pose / framing / brand] unchanged."Single ref only — pick the right one. No multi-image fanout here. If you have multiple references, decide which is primary and pass that one. For multi-image flows, route to Nano Banana Edit.
Iterate on small changes. If Kontext drifts, split a compound edit into sequential single-instruction passes (pass 1: change background, pass 2: change clothing).
Aspect ratio — pick from the supported enum. Out-of-list values 422 or crop.
Anti-patterns:
- Compound prompts ("change A and add B and remove C") → drift.
- Trying to fan out to multiple source images → wrong model (use Nano Banana Edit).
- Prompts written in passive voice → less reliable.
- Asking for novel composition without a source image → wrong model (use Flux 2 Klein t2i).
单个陈述式指令。Kontext在如下格式的提示词上表现出色,例如文档示例:。使用祈使语气,单次只描述一个修改点。
"She is now holding an orange umbrella and smiling"优先声明保留内容。以开头,再描述修改内容。模型会优先遵循开头的声明。
"保留[主体特征/姿势/构图/品牌元素]不变。"仅使用单张参考图——选对参考图。不支持多图扩展。如果有多张参考图,确定主参考图并传入。如需多图流程,请使用Nano Banana Edit。
分多次进行小修改。如果Kontext输出偏离预期,将复合修改拆分为多次单指令操作(第一次:修改背景,第二次:修改服装)。
宽高比——选择支持的枚举值。不在列表中的值会被裁剪或返回错误码422。
反模式:
- 复合提示词(如“修改A、添加B、移除C”)→ 输出偏离预期。
- 尝试传入多张源图→ 模型选择错误(请使用Nano Banana Edit)。
- 被动语态的提示词→ 效果不稳定。
- 无参考图要求生成新构图→ 模型选择错误(请使用Flux 2 Klein文本生成图像功能)。
Where it shines
优势场景
| Use case | Why Flux Kontext |
|---|---|
| Single-shot precise local edit | Specifically designed for this; high fidelity |
| Preserve source identity through targeted change | Strong preservation under explicit instruction |
| Brand-asset text or color swap | Quoted text + preservation lead-in works well |
| Quick iteration on one image | Short prompts + single ref = fast result loop |
| 使用场景 | 选择Flux Kontext的原因 |
|---|---|
| 单次精准局部编辑 | 专为该场景设计;高保真度 |
| 通过定向修改保留源图主体特征 | 在明确指令下具备强大的特征保留能力 |
| 品牌资产的文字或颜色替换 | 结合引用文本和保留声明的提示词效果极佳 |
| 单张图片快速迭代 | 简短提示词+单参考图=快速迭代流程 |
Sample prompts (verified to produce strong results)
验证有效的示例提示词
Page example:
She is now holding an orange umbrella and smilingPreservation-led brand edit:
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.Compositional micro-edit:
Keep the person's face, pose, and clothing unchanged. Add a leather
shoulder bag, dark brown, hanging on the right shoulder.页面示例:
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.Limitations
局限性
- Single source image only. For multi-image flows, use Nano Banana Edit (1–20).
- Public RunComfy docs are minimal — schema fields beyond prompt + image + aspect_ratio + seed may exist; check the model page for the latest field list.
- Compound prompts drift — split into sequential passes.
- For multilingual / embedded text editing, GPT Image 2 edit usually wins.
- 仅支持单张源图。如需多图流程,请使用Nano Banana Edit(支持1–20张)。
- RunComfy公开文档内容有限——除prompt、image、aspect_ratio、seed之外可能存在其他格式字段;请查看模型页面获取最新字段列表。
- 复合提示词易导致输出偏离——拆分为多次操作执行。
- 对于多语言/嵌入文本编辑,GPT Image 2 edit通常效果更好。
Exit codes
退出码
| code | meaning |
|---|---|
| 0 | success |
| 64 | bad CLI args |
| 65 | bad input JSON / schema mismatch |
| 69 | upstream 5xx |
| 75 | retryable: timeout / 429 |
| 77 | not signed in or token rejected |
Full reference: docs.runcomfy.com/cli/troubleshooting.
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI参数错误 |
| 65 | 输入JSON格式错误/不匹配 |
| 69 | 上游服务5xx错误 |
| 75 | 可重试:超时/429请求过多 |
| 77 | 未登录或令牌被拒绝 |
How it works
工作原理
The skill invokes with a JSON body matching the schema. The CLI POSTs to , polls the request, fetches the result, and downloads any / URL into . cancels the remote request before exit.
runcomfy run blackforestlabs/flux-1-kontext/pro/edithttps://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit.runcomfy.net.runcomfy.com--output-dirCtrl-C该技能调用命令,并传入符合格式的JSON参数。CLI会向发送POST请求,轮询请求状态,获取结果,并将所有/域名的下载链接内容保存到指定目录。按会在退出前取消远程请求。
runcomfy run blackforestlabs/flux-1-kontext/pro/edithttps://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit.runcomfy.net.runcomfy.com--output-dirCtrl-CSecurity & Privacy
安全与隐私
- Token storage: writes the API token to
runcomfy loginwith mode 0600 (owner-only read/write). Set~/.config/runcomfy/token.jsonenv var to bypass the file entirely in CI / containers.RUNCOMFY_TOKEN - Input boundary: the user prompt is passed as a JSON string to the CLI via . The CLI does NOT shell-expand the prompt; it transmits the JSON body directly to the Model API over HTTPS. No shell injection surface from prompt content.
--input - Third-party content: image / mask / video URLs you pass are fetched by the RunComfy model server, not by the CLI on your machine. Treat external URLs as untrusted; image-based prompt injection is a known risk for any image-edit / video-edit model.
- Outbound endpoints: only (request submission) and
model-api.runcomfy.net/*.runcomfy.net(download whitelist for generated outputs). No telemetry, no callbacks.*.runcomfy.com - Generated-file size cap: the CLI aborts any single download > 2 GiB to prevent disk-fill from a malicious or runaway model output.
- 令牌存储:会将API令牌写入
runcomfy login文件,权限为0600(仅文件所有者可读写)。在CI/容器环境中,可设置环境变量~/.config/runcomfy/token.json来跳过文件存储。RUNCOMFY_TOKEN - 输入边界:用户提示词通过以JSON字符串形式传递给CLI。CLI不会对提示词进行shell扩展,而是直接通过HTTPS将JSON主体传输到Model API。提示词内容不存在shell注入风险。
--input - 第三方内容:你传入的图片/遮罩/视频URL由RunComfy模型服务器获取,而非本地CLI获取。请将外部URL视为不可信内容;基于图像的提示词注入是所有图像/视频编辑模型都存在的已知风险。
- 出站端点:仅连接(提交请求)和
model-api.runcomfy.net/*.runcomfy.net(生成结果的下载白名单)。无遥测,无回调。*.runcomfy.com - 生成文件大小限制:CLI会终止任何超过2 GiB的单个下载任务,防止恶意或失控的模型输出填满磁盘。