flux-kontext

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Flux 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 -g
Black Forest Labs推出的Flux 1 Kontext Pro——支持单参考精准局部图像编辑——托管在RunComfy Model API上。具备强大的提示词控制能力、输出稳定、高保真度。
bash
npx skills add agentspace-so/runcomfy-skills --skill flux-kontext -g

When to pick this model (vs siblings)

何时选择该模型(对比同类模型)

You wantUse
Single-image precise local edit ("she's now holding X")Flux Kontext
High-fidelity preservation of source identityFlux Kontext
Batch edits across 1–20 imagesNano Banana Edit
Edit multilingual / embedded text in imageGPT Image 2 edit
Generate from scratch, no source imageFlux 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

前置条件

  1. RunComfy CLI
    npm i -g @runcomfy/cli
  2. RunComfy account
    runcomfy login
    opens a browser device-code flow.
  3. CI / containers — set
    RUNCOMFY_TOKEN=<token>
    instead of
    runcomfy login
    .
  1. RunComfy CLI — 执行
    npm i -g @runcomfy/cli
    安装
  2. RunComfy账号 — 执行
    runcomfy login
    会打开浏览器设备码验证流程。
  3. CI/容器环境 — 设置环境变量
    RUNCOMFY_TOKEN=<token>
    替代
    runcomfy login
    登录。

Endpoints + input schema

接口端点 + 输入格式

blackforestlabs/flux-1-kontext/pro/edit

blackforestlabs/flux-1-kontext/pro/edit

FieldTypeRequiredDefaultNotes
prompt
stringyesSingle declarative edit instruction.
image
stringyesSingle source image URL (publicly fetchable HTTPS).
aspect_ratio
enumno(input)Pick from supported W:H options on the model page.
seed
intnoReuse 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.
字段类型是否必填默认值说明
prompt
string单个陈述式编辑指令。
image
string单个源图的可公开访问HTTPS URL。
aspect_ratio
enum(输入图比例)从模型页面支持的宽高比选项中选择。
seed
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:
"She is now holding an orange umbrella and smiling"
. Imperative mood, single change.
Preservation first. Lead with
"Keep [identity / pose / framing / brand] unchanged."
Then the change. Models honor what's stated up front.
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 caseWhy Flux Kontext
Single-shot precise local editSpecifically designed for this; high fidelity
Preserve source identity through targeted changeStrong preservation under explicit instruction
Brand-asset text or color swapQuoted text + preservation lead-in works well
Quick iteration on one imageShort 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 smiling
Preservation-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

退出码

codemeaning
0success
64bad CLI args
65bad input JSON / schema mismatch
69upstream 5xx
75retryable: timeout / 429
77not signed in or token rejected
代码含义
0成功
64CLI参数错误
65输入JSON格式错误/不匹配
69上游服务5xx错误
75可重试:超时/429请求过多
77未登录或令牌被拒绝

How it works

工作原理

The skill invokes
runcomfy run blackforestlabs/flux-1-kontext/pro/edit
with a JSON body matching the schema. The CLI POSTs to
https://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit
, polls the request, fetches the result, and downloads any
.runcomfy.net
/
.runcomfy.com
URL into
--output-dir
.
Ctrl-C
cancels the remote request before exit.
该技能调用
runcomfy run blackforestlabs/flux-1-kontext/pro/edit
命令,并传入符合格式的JSON参数。CLI会向
https://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit
发送POST请求,轮询请求状态,获取结果,并将所有
.runcomfy.net
/
.runcomfy.com
域名的下载链接内容保存到
--output-dir
指定目录。按
Ctrl-C
会在退出前取消远程请求。

Security & Privacy

安全与隐私

  • Token storage:
    runcomfy login
    writes the API token to
    ~/.config/runcomfy/token.json
    with mode 0600 (owner-only read/write). Set
    RUNCOMFY_TOKEN
    env var to bypass the file entirely in CI / containers.
  • Input boundary: the user prompt is passed as a JSON string to the CLI via
    --input
    . 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.
  • 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
    model-api.runcomfy.net
    (request submission) and
    *.runcomfy.net
    /
    *.runcomfy.com
    (download whitelist for generated outputs). No telemetry, no callbacks.
  • Generated-file size cap: the CLI aborts any single download > 2 GiB to prevent disk-fill from a malicious or runaway model output.
  • 令牌存储
    runcomfy login
    会将API令牌写入
    ~/.config/runcomfy/token.json
    文件,权限为0600(仅文件所有者可读写)。在CI/容器环境中,可设置环境变量
    RUNCOMFY_TOKEN
    来跳过文件存储。
  • 输入边界:用户提示词通过
    --input
    以JSON字符串形式传递给CLI。CLI不会对提示词进行shell扩展,而是直接通过HTTPS将JSON主体传输到Model API。提示词内容不存在shell注入风险。
  • 第三方内容:你传入的图片/遮罩/视频URL由RunComfy模型服务器获取,而非本地CLI获取。请将外部URL视为不可信内容;基于图像的提示词注入是所有图像/视频编辑模型都存在的已知风险。
  • 出站端点:仅连接
    model-api.runcomfy.net
    (提交请求)和
    *.runcomfy.net
    /
    *.runcomfy.com
    (生成结果的下载白名单)。无遥测,无回调。
  • 生成文件大小限制:CLI会终止任何超过2 GiB的单个下载任务,防止恶意或失控的模型输出填满磁盘。