跳转到主要内容
POST
/
image
/
edit
/api/v1/image/edit
curl --request POST \
  --url https://api.venice.ai/api/v1/image/edit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "Colorize",
  "image": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAAIGNIUk0A..."
}
'
"<string>"
这是一个实验性端点,可能会发生变化。
定价: 图像编辑价格因模型而异。默认模型(qwen-edit)为每次编辑 $0.04。所有可用的编辑模型及其定价请参阅 Models 端点

质量等级

部分编辑模型接受可选的 quality 参数(lowmediumhigh),用于在视觉保真度和成本之间取得平衡。当前由 gpt-image-2-edit 支持;其他模型会忽略该参数。
{
  "model": "gpt-image-2-edit",
  "image": "iVBORw0KGgo...",
  "prompt": "change the sky to a sunrise",
  "resolution": "2K",
  "quality": "medium"
}
当您省略 quality 时,模型将使用其默认等级(gpt-image-2-edithigh)。各等级价格(1K/2K/4K × low/medium/high)位于 Models 端点model_spec.pricing.quality 下,也在定价概览中列出。
质量感知定价是所有 API 和 SDK 调用方的默认行为 —— 无需显式启用的请求头。省略 quality 的请求按模型的默认等级(gpt-image-2-edithigh)计费。

Postman 集合

如需更多示例,请参阅此 Postman 集合
默认模型(qwen-edit)会拒绝任何尝试生成露骨色情图像、性化未成年人或描绘真实暴力的请求。其他模型可能有不同的内容政策。

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

Edit an image based on the supplied prompt.

image
必填

The image to edit. Can be either a file upload, a base64-encoded string, or a URL starting with http:// or https://. Image dimensions must be at least 65536 pixels and must not exceed 33177600 pixels. File size must be less than 25MB.

prompt
string
必填

The text directions to edit or modify the image. Short, descriptive prompts work best (e.g., "remove the tree", "change the sky to sunrise"). Character limit is model specific and is listed in the promptCharacterLimit setting in the model list endpoint.

Required string length: 1 - 32768
示例:

"Change the color of the sky to a sunrise"

aspect_ratio
enum<string>

The aspect ratio for the output image. Use 'auto' or omit this parameter to infer the closest supported aspect ratio from the input image when explicit sizing is required by the model. Supported values vary by model - check GET /api/v1/models for model-specific options.

可用选项:
auto,
1:1,
3:2,
16:9,
21:9,
9:16,
2:3,
3:4,
4:5
示例:

"16:9"

resolution
string

Resolution tier for the output image (e.g. "1K", "2K", "4K"). Supported values vary by model - check GET /api/v1/models for model-specific options. Defaults to "1K" when not specified.

Required string length: 1 - 10
示例:

"1K"

model
string
默认值:firered-image-edit

The model ID to use for image editing.

Minimum string length: 1
modelId
enum<string>
已弃用

Deprecated: Use "model" instead. The model ID to use for image editing.

可用选项:
firered-image-edit,
qwen-edit,
qwen-edit-uncensored,
grok-imagine-edit,
grok-imagine-quality-edit,
qwen-image-2-edit,
qwen-image-2-pro-edit,
wan-2-7-pro-edit,
flux-2-max-edit,
gpt-image-2-edit,
gpt-image-1-5-edit,
nano-banana-2-edit,
nano-banana-pro-edit,
seedream-v5-lite-edit,
seedream-v4-edit
Minimum string length: 1
output_format
enum<string>

Output format for the edited image. Accepts jpeg, jpg, png, or webp. When omitted, the format is inferred from resolution: PNG for 1K edits and JPEG for 2K/4K edits.

可用选项:
jpeg,
png,
webp
示例:

"png"

safe_mode
boolean
默认值:true

Whether to use safe mode. If enabled, this will blur images that are classified as having adult content.

示例:

false

响应

OK

The response is of type file.