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

接口端点与输入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重复使用可生成对比变体图
该Schema刻意简化——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外可能存在其他schema字段;请查看模型页面获取最新字段列表
  • 复合提示词易偏离预期——需拆分为多次编辑
  • 如需编辑多语言/嵌入文本,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错误/Schema不匹配
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.
该技能通过符合Schema的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
域名下的输出文件下载至
--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请求体传输至模型API。提示词内容不存在shell注入风险。
  • 第三方内容:你传入的图片/蒙版/视频URL由RunComfy模型服务器获取,而非本地CLI。请将外部URL视为不可信;基于图像的提示注入是所有图像/视频编辑模型的已知风险。
  • 出站端点:仅与
    model-api.runcomfy.net
    (请求提交)和
    *.runcomfy.net
    /
    *.runcomfy.com
    (生成输出下载白名单)通信。无遥测数据,无回调操作。
  • 生成文件大小限制:CLI会中止任何超过2 GiB的单个文件下载,防止恶意或异常模型输出占满磁盘空间。