编辑图片
edit_imageEdit one or more images with prompts and optional masks through the OpenAI Images edit API, using URL, base64, or local file inputs.
Instructions
通过 OpenAI Images API(/v1/images/edits)编辑图片,支持单图、多图、mask 与 gpt-image-2 / 2.5 系列模型。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | 生成图片数量(1-10,默认 1)。 | |
| mask | No | 图片来源:http(s) URL、base64 data URI 或本地文件路径(本地路径仅 Node 运行时)。 | |
| size | No | 图片尺寸:auto 或 宽x高;不同模型对尺寸的限制不同。 | auto |
| model | No | 图像模型 ID,例如 gpt-image-2.5-flare;必须以 gpt-image- 开头。 | |
| images | Yes | 输入图片列表(1-16 张)。 | |
| inline | No | 是否以 MCP image content 内联返回图片;设为 false 时必须提供 output_path。 | |
| prompt | Yes | 图像生成或编辑的提示词(1-32000 个字符)。 | |
| quality | No | 生成质量;xhigh 与 max 仅 gpt-image-2.5 系列支持。 | medium |
| overwrite | No | 是否允许覆盖已存在的文件。 | |
| background | No | 背景模式;transparent 只能配合 png 或 webp。 | auto |
| moderation | No | 内容审核级别(默认 auto)。 | auto |
| output_path | No | 保存路径:目录或以 / 结尾时按 image_1.ext 命名,文件路径且 n>1 时按 stem-1.ext 命名。 | |
| output_format | No | 输出图片格式(默认 png)。 | png |
| input_fidelity | No | 输入保真度,仅 gpt-image-1.5 与 gpt-image-1-mini 支持。 | |
| output_compression | No | 输出压缩率(0-100),仅 jpeg 与 webp 有效。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | ||
| model | Yes | ||
| usage | No | ||
| images | Yes | ||
| quality | No | ||
| warning | No | ||
| saved_paths | No |