图像编辑
在 CometAPI 中使用 POST /v1/images/edits,通过 multipart 上传、mask、GPT 图像模型以及编码图像输出控制来编辑图像。
使用此路由可在 CometAPI 上通过兼容 OpenAI 的 multipart 上传来编辑现有图像。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
在以下情况下使用此路由
- 你已经有一张源图像,并且希望基于 prompt 进行编辑
- 你可能需要使用 mask 来实现定向修改
- 相比普通 JSON 请求,你可以处理 multipart 文件上传
安全的首次请求
- 从一个 PNG 或 JPG 文件开始
- 在基础编辑流程跑通之前先跳过 mask
- 在此路由上发起 GPT 图像编辑请求时,使用
model: "gpt-image-2" - 使用一条简短指令,只要求一个可见改动
- 从
data[0].b64_json读取编辑后的结果 - 当你希望获得 JPEG 负载时,设置
output_format: "jpeg" - 预期其延迟会高于普通图像生成
模型行为
- 此路由上的 GPT 图像编辑模型会返回内联 base64 图像数据
output_format控制b64_json内部编码后的图像类型response_format仅在模型支持 URL 输出时才有意义qwen-image-edit会在同一个 CometAPI 路由后遵循提供商特定的编辑行为
授权
Bearer token authentication. Use your CometAPI key.
请求体
Source image file. Start with one PNG or JPG input for the simplest flow.
Edit instruction describing the change you want.
"Add a small red ribbon to the paper boat."
The image editing model to use. Choose a supported model from the Models page.
Optional PNG mask. Transparent areas indicate regions that should be edited.
Number of edited images to return.
Quality setting for models that support it.
high, medium, low Requested response container when supported by the selected model. GPT image edit models return data[].b64_json; use output_format to choose the encoded image type.
url, b64_json Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.
"jpeg"
Requested output size when supported by the selected model.