OpenAI GPT Image 2 Edit 图像编辑
openai/gpt-image-2/edit
OpenAI 的 GPT Image 2 Edit 可通过自然语言指令结合一张或多张参考图片进行图像编辑。提供即用型 REST 推理 API,性能最佳,无冷启动,价格实惠。
示例
参数
| 名称 | 类型 | 默认 | 约束 | 说明 |
|---|---|---|---|---|
| images *图片 | image_upload | — | image/* · 1–10 items | 用于编辑的输入图片 URL 列表。 |
| prompt *提示词 | textarea | — | ≤ 5000 chars | 用于生成的正向提示词。 |
| n生成数量 | slider | 1 | 1 ~ 10 | 生成图片的数量(1-10)。每张图片独立计费。 |
| aspect_ratio宽高比 | select | — | 1:1 | 1:2 | 1:3 | 2:1 | 2:3 | 3:1 | 3:2 | 3:4 | … | 生成图片的宽高比。如果指定了 'size' 参数,则此设置失效。 |
| resolution分辨率 | select | — | 1k | 2k | 4k | 输出分辨率级别。如果指定了 'size' 参数,则此设置失效。 |
| size具体尺寸 | text | auto | — | 图片具体尺寸。格式为宽x高。如果指定了此参数,宽高比 (aspect_ratio) 和分辨率 (resolution) 参数将失效。 |
| quality渲染质量 | select | auto | auto | low | medium | high | 渲染质量。low=快速草稿,high=精细输出。质量越高,耗时越长、费用越高。 |
| mask蒙版图片 | image_upload | — | image/* · 0–1 items | 通过 URL 引用输入图片。只需提供一张。 |
| background背景模式 | select | auto | auto | transparent | opaque | 生成图片输出的背景行为。 |
| input_fidelity输入忠实度 | select | low | low | high | 控制对原始输入图片的忠实度。 |
| output_format图片格式 | select | png | png | jpeg | webp | 图片格式。JPEG 比 PNG 更快,适合延迟敏感场景。 |
| output_compression压缩级别 | number | — | 0 ~ 100 | 压缩级别,仅对 JPEG/WebP 有效(0-100)。 |
| moderation审核级别 | select | auto | auto | low | 内容审核级别。low 放宽过滤,auto 为标准过滤。 |
输出字段
| 字段 | 类型 | 说明 |
|---|---|---|
| images | array<string> |
API
通过统一 REST API 调用本模型;在 API Keys 页获取密钥。
cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/openai/gpt-image-2/edit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"images": [
"https://assets-public.namifusion.com/uploads/images/2026-04-24/b96da2a48506.png",
"https://assets-public.namifusion.com/uploads/images/2026-04-24/4831013a68e1.png"
],
"prompt": "A futuristic cityscape at sunset, with glowing skyscrapers and flying cars.",
"n": 3,
"aspect_ratio": "16:9",
"resolution": "4k",
"size": "1024x1024",
"quality": "high",
"background": "auto",
"input_fidelity": "low",
"output_format": "jpeg",
"output_compression": 85,
"moderation": "auto"
}
}'
# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
-H "Authorization: Bearer YOUR_API_KEY"Python
import time, requests
API_KEY = "YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1) Submit
resp = requests.post(
"https://www.namifusion.com/api/v1/marketplace/run/openai/gpt-image-2/edit",
headers=HEADERS,
json={
"input": {
"images": [
"https://assets-public.namifusion.com/uploads/images/2026-04-24/b96da2a48506.png",
"https://assets-public.namifusion.com/uploads/images/2026-04-24/4831013a68e1.png"
],
"prompt": "A futuristic cityscape at sunset, with glowing skyscrapers and flying cars.",
"n": 3,
"aspect_ratio": "16:9",
"resolution": "4k",
"size": "1024x1024",
"quality": "high",
"background": "auto",
"input_fidelity": "low",
"output_format": "jpeg",
"output_compression": 85,
"moderation": "auto"
}
},
)
resp.raise_for_status() # 401/402/429/5xx stop here instead of polling a bad task
task = resp.json()
# 2) Poll until a terminal state (completed / failed / cancelled).
# This model is allowed up to 600s server-side.
deadline = time.time() + 660
while task.get("status") not in ("completed", "failed", "cancelled"):
if time.time() > deadline:
raise TimeoutError(f"still {task.get('status')} — keep the task_uuid and poll later")
time.sleep(3)
poll = requests.get(f"https://www.namifusion.com/api/v1/marketplace/run/tasks/{task['task_uuid']}", headers=HEADERS)
poll.raise_for_status()
task = poll.json()
print(task["status"], task.get("output"))JavaScript
const API_KEY = "YOUR_API_KEY";
const HEADERS = { Authorization: `Bearer ${API_KEY}` };
// 1) Submit
const resp = await fetch("https://www.namifusion.com/api/v1/marketplace/run/openai/gpt-image-2/edit", {
method: "POST",
headers: { ...HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({
"input": {
"images": [
"https://assets-public.namifusion.com/uploads/images/2026-04-24/b96da2a48506.png",
"https://assets-public.namifusion.com/uploads/images/2026-04-24/4831013a68e1.png"
],
"prompt": "A futuristic cityscape at sunset, with glowing skyscrapers and flying cars.",
"n": 3,
"aspect_ratio": "16:9",
"resolution": "4k",
"size": "1024x1024",
"quality": "high",
"background": "auto",
"input_fidelity": "low",
"output_format": "jpeg",
"output_compression": 85,
"moderation": "auto"
}
}),
});
if (!resp.ok) throw new Error(`submit failed: ${resp.status} ${await resp.text()}`);
let task = await resp.json();
// 2) Poll until a terminal state (completed / failed / cancelled).
// This model is allowed up to 600s server-side.
const deadline = Date.now() + 660 * 1000;
while (!["completed", "failed", "cancelled"].includes(task.status)) {
if (Date.now() > deadline) throw new Error(`still ${task.status} — keep the task_uuid and poll later`);
await new Promise((r) => setTimeout(r, 3000));
const poll = await fetch(`https://www.namifusion.com/api/v1/marketplace/run/tasks/${task.task_uuid}`, { headers: HEADERS });
if (!poll.ok) throw new Error(`poll failed: ${poll.status}`);
task = await poll.json();
}
console.log(task.status, task.output);文档
OpenAI GPT Image 2 Edit
通过自然语言轻松实现图片编辑
OpenAI GPT Image 2 Edit 是一款先进的文本生成图片模型,可通过自然语言指令实现无缝图片编辑。该模型支持使用一个或多个参考图片进行高质量编辑,具有强提示词匹配能力、生产级质量输出以及灵活的宽高比选项。通过即用型 REST API,开发者可以轻松将其集成到创意工作流中,无需担心冷启动延迟。
🚀 主要功能
- 自然语言图片编辑:只需用简单的语言描述所需修改,无需手动遮罩或复杂编辑流程。
- 支持参考图片:使用一个或多个输入图片作为编辑、转换或风格调整的视觉来源。
- 灵活的宽高比:支持生成正方形、竖屏、横屏或宽屏格式的输出,以满足不同设计需求。
- 生产级 API:通过强大的 REST API 轻松集成到应用程序、工具和创意管道中。
- 快速且经济实惠:提供高质量图片编辑服务,采用基于使用的定价模式,无冷启动问题。
🛠️ 技术规格
| 参数 | 类型 | 是否必需 | 默认值 | 选项范围 | 描述 |
|---|---|---|---|---|---|
images | 数组 | 是 | N/A | N/A | 要编辑的参考图片 URL 列表。 |
prompt | 字符串 | 是 | N/A | N/A | 描述所需编辑的文本提示词。 |
aspect_ratio | 字符串 | 否 | 自动检测 | 1:1、3:2、2:3、3:4、4:3、4:5、5:4、9:16、16:9、21:9 | 生成图片的宽高比。如果未指定,将从输入图片中自动检测。 |
resolution | 字符串 | 否 | 1k | 1k、2k | 输出图片的分辨率。 |
quality | 字符串 | 否 | 中等 | 低、中、高 | 生成图片的质量。更高质量会产生更高费用。 |
示例提示词
将这张产品照片变成一个高端工作室广告,使用柔和的电影灯光、干净的米色背景、细腻的阴影、真实的反射效果以及奢侈品牌美学。
💰 定价
| 模型 | 模态 (Modality) | 输入 (Input) | 缓存输入 (Cached input) | 输出 (Output) |
|---|---|---|---|---|
| gpt-image-2 | 图像 | $8.00 | $2.00 | $30.00 |
| 文本 | $5.00 | $1.25 | - |
💡 最佳应用场景
- 产品照片增强:将普通产品照片升级为高端营销视觉效果。
- 创意修饰:通过自然语言指令修改背景、灯光、风格或构图。
- 营销适配:将现有品牌素材重新制作成新的活动视觉效果,无需从头开始创建。
- 社交媒体内容:快速编辑图片以适配平台发布格式,用于帖子、广告和促销。
- 设计迭代:使用不同提示词探索同一基础图片的多种视觉方向。
- 电商优化:提升产品展示效果,用于商品列表、主视觉横幅和促销创意。
🔗 相关模型
- OpenAI GPT Image 2 Text-to-Image:直接通过自然语言提示词生成新图片。
专业提示:明确描述哪些部分需要保持不变,哪些需要修改。清晰地说明视觉风格、灯光和氛围,以获得最佳效果。
相关模型
xAI Grok Imagine Image v2.0 文生图
xAI Grok Imagine Image V2.0 文生图可根据文本提示词生成高质量图片,并支持配置宽高比、分辨率和质量,适用于创意视觉、社交内容、营销素材和生产工作流。提供开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。
Qwen Image 3.0 Pro 文生图
Qwen Image 3.0 Pro 是一款专业级文生图模型,具备卓越画质和先进的提示词理解能力。最高支持 2k。提供开箱即用的 REST inference API,性能出色,无冷启动,价格实惠。
OpenAI GPT Image 2 文本生成图片
OpenAI 的 GPT Image 2 文本生成图片模型可根据自然语言提示词生成高质量图片。提供即用型 REST 推理 API,性能最佳,无冷启动,价格实惠。
Nami Z-Image T2I Spicy
根据文本提示词生成图片,支持自定义宽高、提示词优化和随机种子。
Nano Banana 文生图
Gemini 2.5 Flash 标准版。轻量极速。兼顾速度与成本,是批量生成与快速原型设计的最佳选择。
Nano Banana Pro 文生图
Gemini 3.0 Pro 旗舰版。专为 4K 原生画质打造,支持图像内多语言文字渲染与专业摄影参数控制。
Nano Banana Pro 文生图
Gemini 3.0 Pro 旗舰版。专为 4K 原生画质打造,支持图像内多语言文字渲染与专业摄影参数控制。
Google Nano Banana Lite 文生图 API
Google Nano Banana 2 Lite 文生图可根据文本提示词生成高质量图片,具备低延迟、灵活宽高比和快速出图能力,适用于创意与生产工作流。即开即用的 REST 推理 API,性能出色,无冷启动,价格实惠。