flux-kontext
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFlux Kontext Pro — Pro Pack on RunComfy
Flux Kontext Pro — 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.
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| 字符串 | 是 | — | 单个声明式编辑指令 |
| 字符串 | 是 | — | 可公开访问的HTTPS格式源图片URL |
| 枚举类型 | 否 | (输入图像比例) | 从模型页面支持的宽高比选项中选择 |
| 整数 | 否 | — | 重复使用可生成对比变体 |
该格式刻意简化——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请求体传输至模型API。提示词内容不存在shell注入风险。
--input - 第三方内容:你传入的图片/遮罩/视频URL由RunComfy模型服务器获取,而非本地CLI。请将外部URL视为不可信内容;基于图像的提示词注入是所有图像/视频编辑模型的已知风险。
- 出站接口:仅与(提交请求)和
model-api.runcomfy.net/*.runcomfy.net(下载生成结果的白名单域名)通信。无遥测数据,无回调操作。*.runcomfy.com - 生成文件大小限制:CLI会终止任何超过2 GiB的单个文件下载,防止恶意或异常模型输出占满磁盘空间。