Skip to main content
Image editing on Venice is synchronous. Send your source image to /image/edit or /image/multi-edit and the edited result comes back in the same response as a PNG file. For cutouts, /image/background-remove returns a transparent PNG.
The image edit endpoints are experimental and model-specific behavior may change over time.

Endpoints

EndpointPurposeBest for
POST /image/editEdit a single image with a promptGeneral edits and prompt-driven inpainting
POST /image/multi-editEdit using 1-3 layered imagesMore controlled edits with masks or overlays
POST /image/background-removeRemove the background from an imageTransparent cutouts for products, portraits, and assets

When to use which endpoint

  • Use /image/edit when you have one source image and want to change, remove, or restyle part of it with a prompt.
  • Use /image/multi-edit when you need extra control from masks, overlays, or reference layers.
  • Use /image/background-remove when you only want a clean foreground subject with transparency.
For inpainting, use /image/edit or /image/multi-edit. The old inpaint parameter on /image/generate is deprecated.

Step 1: Edit a single image

Single-image edit is the simplest inpainting flow. Send one image plus a short prompt such as “remove the sign”, “change the sky to sunrise”, or “replace the background with a studio backdrop”. Request:
POST https://api.venice.ai/api/v1/image/edit
Authorization: Bearer $VENICE_API_KEY
Content-Type: application/json

{
  "model": "qwen-edit",
  "prompt": "Replace the cloudy sky with a warm sunrise while preserving the buildings and canal",
  "image": "https://example.com/venice-canal.jpg"
}
Response (200): The response body is raw image/png binary data. Save it directly to a file.
import base64
import os
import requests

with open("input.jpg", "rb") as f:
    image_base64 = base64.b64encode(f.read()).decode("utf-8")

response = requests.post(
    "https://api.venice.ai/api/v1/image/edit",
    headers={
        "Authorization": f"Bearer {os.environ['VENICE_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "qwen-edit",
        "prompt": "Remove the tourist crowd from the square and keep the architecture intact",
        "image": image_base64,
    },
)

with open("edited.png", "wb") as f:
    f.write(response.content)

Step 2: Use multi-edit for masks or layered inpainting

/image/multi-edit accepts up to three images. The first image is the base image. The remaining images are treated as edit layers or masks, which gives you more control than prompt-only editing. This is the better choice when you want to:
  • target a specific region with a mask
  • combine an existing composition with an overlay
  • constrain the edit more tightly than a single-image prompt can
JSON request:
{
  "modelId": "qwen-edit",
  "prompt": "Replace the blank billboard area with a glowing Venice film festival poster while preserving lighting and perspective",
  "images": [
    "https://example.com/street-scene.png",
    "https://example.com/billboard-mask.png"
  ]
}
Multipart request:
curl https://api.venice.ai/api/v1/image/multi-edit \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -F "modelId=qwen-edit" \
  -F "prompt=Replace the blank billboard area with a glowing Venice film festival poster while preserving lighting and perspective" \
  -F "[email protected]" \
  -F "[email protected]" \
  -o multi-edited.png
Like /image/edit, the response body is raw image/png data.
/image/multi-edit currently uses the modelId field rather than model in the request schema.

Inpainting tips

Prompt-based inpainting works best when the instruction is short and local:
  • remove the tree
  • change the sky to sunset
  • replace the logo with a blank sign
  • restore the torn corner of the photo
For broader scene changes, describe what should stay the same:
Replace the background with a modern photo studio backdrop while preserving the subject pose, facial features, and clothing.
If the edit keeps affecting the wrong area, switch from /image/edit to /image/multi-edit and provide a mask or overlay layer.

Step 3: Remove the background

Use /image/background-remove when you want the foreground subject isolated on a transparent background. This endpoint returns a PNG with alpha transparency. Using an image URL:
curl https://api.venice.ai/api/v1/image/background-remove \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -o cutout.png \
  -d '{
    "image_url": "https://example.com/product-photo.jpg"
  }'
Using a local file upload:
curl https://api.venice.ai/api/v1/image/background-remove \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -F "[email protected]" \
  -o cutout.png
Use background removal for:
  • ecommerce product photos
  • profile photos and portraits
  • assets you plan to place over a new background

Request Parameters

/image/edit

ParameterTypeRequiredDefaultDescription
imagefile, base64 string, or URLYes-Source image to edit
promptstringYes-Text instructions for the edit
modelstringNoqwen-editEdit model ID
aspect_ratiostringNomodel defaultOutput ratio for models that support it
modelIdstringDeprecated-Deprecated alias for model

/image/multi-edit

ParameterTypeRequiredDefaultDescription
imagesarray of 1-3 files, base64 strings, or URLsYes-First image is the base image; the rest are edit layers or masks
promptstringYes-Text instructions for how to combine or edit the layers
modelIdstringNoqwen-editEdit model ID

/image/background-remove

ParameterTypeRequiredDescription
imagefile or base64 stringOne of image or image_urlSource image to cut out
image_urlstringOne of image or image_urlPublic image URL to cut out

Supported input formats

EndpointJSON inputMultipart inputOutput
/image/editBase64 string or URLFile uploadimage/png
/image/multi-editBase64 strings or URLsFile uploadsimage/png
/image/background-removeBase64 string or URLFile uploadimage/png
For edit endpoints, image dimensions must be at least 65536 pixels and no more than 33177600 pixels. Uploaded files must be under 25MB.

Models and pricing

The default edit model is qwen-edit, priced at $0.04 per edit. Other edit-capable models may have different pricing and constraints. See:

Errors

StatusMeaningAction
400Invalid request parametersCheck image count, field names, and input format
401Authentication failedCheck your API key
402Insufficient balanceAdd credits at venice.ai/settings/api
415Invalid content typeUse JSON or multipart form-data correctly
429Rate limit exceededRetry with backoff
500Inference processing failedRetry the request
503Model at capacityRetry after a short delay
Some edit models have stricter content policies than image generation models. For example, qwen-edit blocks requests involving explicit sexual imagery, sexualized minors, or real-world violence.