
gpt-image-2
使用 RunComfy 上的 OpenAI GPT Image 2(ChatGPT Images 2.0)生成和编辑图像。本文档介绍了 GPT Image 2 的优势(嵌入文本、标志、多语言排版、指令精确性)、其 3 种固定尺寸、保留性编辑语言,以及何时应转向其他模型(Flux 2 / Nano Banana Pro / Seedream)。通过本地 RunComfy CLI 调用 `runcomfy run openai/gpt-image-2/text-to-image` 或 `/edit`。触发词包括 "gpt image 2"、"gpt-image-2"、"ChatGPT Images 2"、"image 2" 或任何明确要求使用此模型生成或编辑的请求。
Generate and edit images with OpenAI GPT Image 2 (ChatGPT Images 2.0) on RunComfy. Documents GPT Image 2's strengths (embedded text, logos, multilingual typography, instruction precision), its 3 fixed sizes, edit-with-preservation language, and when to route to a sibling (Flux 2 / Nano Banana Pro / Seedream) instead. Calls `runcomfy run openai/gpt-image-2/text-to-image` or `/edit` through the local RunComfy CLI. Triggers on "gpt image 2", "gpt-image-2", "ChatGPT Images 2", "image 2", or any explicit ask to generate or edit with this model.
GPT Image 2 — RunComfy 上的专业版
runcomfy.com · 文生图 · 编辑 · GitHub
OpenAI GPT Image 2(ChatGPT Images 2.0)托管在 RunComfy Model API 上——无需 OpenAI 密钥,异步 REST。
npx skills add agentspace-so/runcomfy-skills --skill gpt-image-2 -g
何时选择此模型(与其他模型对比)
GPT Image 2 的独特优势在于指令精确性:它能比同类模型更可靠地遵循多元素提示、布局提示和嵌入文本指令。当画布上的内容比风格化外观更重要时,选择它。
| 需求 | 使用 |
|---|---|
| 嵌入文本、标志、标牌、多语言排版 | GPT Image 2 |
| 品牌安全、电商/广告/UI 模型图像 | GPT Image 2 |
| 保持构图稳定的迭代优化 | GPT Image 2 |
| 重度风格化、绘画感 | Flux 2 |
| 超写实肖像 | Nano Banana Pro |
| 电影感/美学优先的主打图 | Seedream 5 |
如果用户明确要求 GPT Image 2 / ChatGPT Image 2 / Image 2,请直接路由至此——不要质疑模型选择。
前提条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy 账户 —
runcomfy login会打开浏览器设备码流程。 - CI/容器 — 设置
RUNCOMFY_TOKEN=<token>替代runcomfy login。
端点 + 输入模式
两个端点,同一模型。
openai/gpt-image-2/text-to-image
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
prompt |
string | 是 | — | 正向提示词 |
size |
enum | 否 | 1024_1024 |
1024_1024(1:1)、1024_1536(2:3 竖屏)、1536_1024(3:2 横屏)——仅此三种 |
openai/gpt-image-2/edit
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
prompt |
string | 是 | — | 自然语言编辑指令 |
images |
string[] | 是 | — | 最多 10 张参考图片 URL(可公开获取的 HTTPS) |
size |
enum | 否 | auto |
auto(保持输入比例),或上述三种固定尺寸之一 |
编辑时 size=auto 会保持输入宽高比——除非编辑明确改变构图,否则强烈推荐。
如何调用
文生图:
runcomfy run openai/gpt-image-2/text-to-image \
--input '{"prompt": "<用户提示>", "size": "1024_1536"}' \
--output-dir <绝对路径>
编辑(单张参考图):
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "<编辑指令>",
"images": ["https://..."]
}' \
--output-dir <绝对路径>
编辑(多张参考图,最多 10 张):
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "将图 1 的主体合成到图 2 的房间中;匹配图 2 的光照",
"images": ["https://...subject.jpg", "https://...room.jpg"]
}' \
--output-dir <绝对路径>
CLI 提交请求,每 2 秒轮询直到完成,然后将结果中所有 *.runcomfy.net / *.runcomfy.com 的 URL 下载到 --output-dir。标准输出为结果 JSON。标准错误为进度信息。
适用于管道的用法:
runcomfy --output json run openai/gpt-image-2/text-to-image \
--input '{"prompt":"..."}' --no-wait | jq -r .request_id
提示技巧——实际有效的方法
以下是针对该模型的经验性模式,可提高输出质量。适用于文生图和编辑。
明确说明主体、场景和氛围。 "A close-up of a matte ceramic water bottle on warm linen, soft window light, neutral background"——三个具体指令——优于 "nice product photo of a bottle"。
精确引用嵌入文本。保持简短。 GPT Image 2 是此类模型中文本渲染最强的,但前提是将实际字符放在引号中。长文本块会降低质量。对于多语言文本,请指明文字类型:"Japanese kana"、"Cyrillic"、"Arabic right-to-left"。
直接使用构图提示。 "rule of thirds"、"close-up"、"aerial view"、"centered subject"、"shallow depth of field"——这些对模型有学习到的含义。
一次只迭代一个属性。 优化时,每次只更改一个方面(光照或背景或姿势或文本),并保持提示的其他部分不变。当只改变一个变量时,模型会在多次迭代中保持构图稳定。
不要冲突的指令。 "no text" + "the word 'AQUA+' on the label" 是不连贯的——模型会选择其中一个,你无法控制哪个。
不要堆砌风格。 "ukiyo-e + watercolor + 8K + cinematic + minimalist" 会相互抵消。最多选择一两个风格锚点。
对于编辑端点,特别提示:
- 说明保留目标。 "keep the person's pose and face identity unchanged"、"keep the brand mark and typography on the package"、"keep the overall framing"。模型需要知道什么不能改变。
- 使用方向性语言进行空间编辑。 "Move the headline from top-right to bottom-center",而不是 "reposition the headline"。
- 多参考图:在提示中给图片编号——"subject from image 1, lighting and background from image 2"——模型会正确路由提示。
适用场景
| 用例 | 为什么选择 GPT Image 2 |
|---|---|
| 电商产品摄影 | 标签上的文本可靠,品牌安全的光照,SKU 间一致 |
| 高转化率广告 | 标题与视觉一次集成 |
| 品牌素材本地化 | 一个源素材 → 同一标题的多种语言变体 |
| 标牌、海报、包装模型 | 多尺度下的文本渲染准确性 |
| UI 模型、科学插图 | 布局精度和标签清晰度 |
示例提示(已验证可产生强结果)
文生图——产品主图:
A minimal hero product still life: a matte ceramic water bottle on warm linen,
soft window light, the word "AQUA+" in clean sans-serif on the label,
subtle rim highlights, e-commerce ready, 8K detail, neutral background
文生图——多语言标牌:
A small Tokyo café storefront at dusk, warm interior glow,
the sign reads "コーヒー" in bold Japanese kana on a wooden plaque,
shallow depth of field, rule of thirds, cinematic
编辑——背景替换并保留主体:
Turn the background into a bright minimal white-to-soft-gray studio sweep
with gentle floor shadow; add a large headline in-image that reads
"OPEN STUDIO" in a bold clean sans-serif, high contrast, centered;
keep the main person or product, pose, and face identity unchanged
限制
- 文生图仅 3 种固定尺寸(编辑时相同 3 种加
auto)。极端宽高比会自动调整为最接近的受支持尺寸。 - 提示长度约几千个 token。长文本块会降低输出质量。
- 编辑的多图支持是“最多 10 张参考图的引导”,而非 ControlNet 式堆叠。第一张图作为主要参考,其余提供辅助提示。
- 肖像照片写实并非其最强项——Nano Banana Pro 在这方面更胜一筹。
退出码
runcomfy CLI 使用 sysexits 风格码:
| 码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI 参数错误 |
| 65 | 输入 JSON 错误/模式不匹配(例如 size: "2048_2048" 会返回 422) |
| 69 | 上游 5xx 错误 |
| 75 | 可重试:超时/429 |
| 77 | 未登录或令牌被拒绝 |
完整参考:docs.runcomfy.com/cli/troubleshooting。
工作原理
- 技能调用
runcomfy run openai/gpt-image-2/<endpoint>,并传入符合上述模式的 JSON 体。 - CLI 使用用户的 bearer 令牌向
https://model-api.runcomfy.net/v1/models/openai/gpt-image-2/<endpoint>发送 POST 请求。 - Model API 返回
request_id;CLI 每 2 秒轮询GET .../requests/<id>/status。 - 状态变为终态后,CLI 获取
GET .../requests/<id>/result,并将主机名以.runcomfy.net或.runcomfy.com结尾的所有 URL 下载到--output-dir。其他 URL 仅列出但不下载。 - 轮询期间按
Ctrl-C会发送POST .../requests/<id>/cancel,避免为已停止的 GPU 付费。
此技能不是什么
不是直接的 OpenAI API 客户端。不是能力授权——依赖于有效的 RunComfy 账户。不是多租户。
安全与隐私
- 令牌存储:
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 的单个下载,以防止恶意或失控模型输出导致磁盘填满。





