/image/edit 或 /image/multi-edit,编辑后的结果会在同一响应中以图像文件形式返回。对于抠图,/image/background-remove 返回透明 PNG。
端点
Venice 没有与 OpenAI 兼容的
/images/edits 端点,因此 client.images.edit() 等 OpenAI SDK 调用会返回 404。请改为将编辑请求发送到 /image/edit。何时使用哪个端点
- 当您有一张源图像并希望用 prompt 改变、移除或重新风格化其部分时,使用
/image/edit。 - 当您需要以额外的参考图像作为编辑条件时,使用
/image/multi-edit。 - 当您只想要一个干净的、透明背景的前景主体时,使用
/image/background-remove。
对于 inpainting,请使用
/image/edit 或 /image/multi-edit。/image/generate 上旧的 inpaint 参数已弃用。第 1 步:编辑单张图像
单图像编辑是最简单的 inpainting 流程。发送一张图像加一个简短 prompt,例如 “remove the sign”、“change the sky to sunrise” 或 “replace the background with a studio backdrop”。 请求:transparent_background 为 true 时,任何分辨率下均为 PNG。将 output_format 设置为 jpeg、png 或 webp 可显式指定格式。
编辑端点没有 response_format 参数,因此无法以 base64 JSON 形式返回图像。如果需要 base64,请自行对响应字节进行编码。
第 2 步:使用 multi-edit 搭配参考图像
/image/multi-edit 接受多张图像,上限因模型而异。请从 GET /models?type=inpaint 读取 model_spec.constraints.maxInputImages 来获取给定模型的上限。如果该字段不存在,上限为 3;当 combineImages 为 false 时,上限为 1。
第一张是基础图像。其余图像是为编辑提供条件的额外参考。
公开端点没有遮罩通道。额外图像作为作用于整张图像的参考,而非区域映射。没有
mask 参数,发送该参数会返回 400。请通过精确的 prompt 来约束编辑生效的位置。- 将现有构图与额外的参考图像组合
- 为模型提供要应用的风格、物体或纹理示例
- 比单图像 prompt 更严格地约束编辑
/image/edit 一样,响应体是原始图像数据,输出格式遵循相同的规则。
/image/multi-edit 目前在请求 schema 中使用 modelId 字段,而非 model。Inpainting 技巧
基于 prompt 的 inpainting 在指令简短且局部时效果最好:remove the treechange the sky to sunsetreplace the logo with a blank signrestore the torn corner of the photo
/image/edit 切换到 /image/multi-edit,并提供一张展示期望效果的额外参考图像,然后在 prompt 中精确描述预期的更改。
第 3 步:移除背景
当您希望前景主体在透明背景上单独显示时,请使用/image/background-remove。此端点返回带 alpha 透明度的 PNG。
使用图像 URL:
- 电商产品照片
- 个人资料照片和人像
- 您打算放在新背景上的素材
/image/generate、/image/edit 和 /image/multi-edit 在受支持的模型上接受 transparent_background: true,并直接返回 alpha 通道。比较详情请参见透明背景图像。
请求参数
/image/edit
/image/multi-edit
/image/background-remove
/image/background-remove 使用固定的内部模型。它不接受 model 字段。发送该字段(例如 "model": "bria-bg-remover")会返回 400,因为 model 不是可识别的字段。成人内容与安全模式
/image/edit 和 /image/multi-edit 都接受 safe_mode(默认:true)。启用时,编辑输出中的成人内容会被模糊处理,因此请发送 safe_mode: false 以获取未模糊的输出:
safe_mode 如何设置均会生效。如需无审查编辑,请使用 qwen-edit-uncensored。
各端点间的审核字段名差异常常让人困惑:
向
/images/generations 传递 safe_mode 会返回 400 及 Unrecognized key(s) in object: 'safe_mode'。
支持的输入格式
对于编辑端点,图像尺寸必须至少为 256×256 像素,且总像素数不得超过 33,177,600(8K 分辨率)。上传文件必须小于
25MB。
模型和定价
默认编辑模型是firered-image-edit,价格为每次编辑 $0.04**。其他具备编辑能力的模型可能有不同的定价和限制。Prompt 增强会在编辑价格上叠加**每次成功应用的重写 $0.04。
请参阅:
- 图像定价
- 带有
type=inpaint的 Models API
错误
某些编辑模型的内容政策比图像生成模型更严格。违反所选模型政策的请求会以
422 被拒绝。相关工作流
- 如果您从文本而非现有图像开始,请使用图像生成。
- 使用 Prompt 增强了解带视觉理解能力的编辑重写是如何工作的。
- 使用图像模型比较生成、编辑和增强模型家族。
- 使用 Image Edit API、Multi-Edit API 和 Background Remove API 了解完整 schema 细节。