Skip to main content
The edits endpoint changes an existing image based on a prompt. This is image-to-image: you send one or more reference images plus an instruction, and you get a new image back. It works with the official OpenAI image SDKs, the same as image generation.
EndpointWhat it does
POST /v1/images/editsEdit an existing image with one or more reference images
Unlike generation, an edit request is sent as multipart/form-data because it uploads image files. deepshi-image-1 is a good default; it accepts up to five reference images.

Step 1: Send an edit request

Send a model, a prompt, and at least one image file:
curl
curl https://api.deepshi.ai/v1/images/edits \
  -H "Authorization: Bearer $DEEPSHI_API_KEY" \
  -F model="deepshi-image-1" \
  -F prompt="remove the person on the left" \
  -F 'image[]=@input.png'
The response is the same as generation. The edited image is base64-encoded in data[0].b64_json:
{
  "created": 1782595538,
  "model": "deepshi-image-1",
  "size": "1024x1024",
  "data": [
    { "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...", "index": 0 }
  ],
  "usage": {
    "cost": { "total_cost": 0.01 }
  }
}

Step 2: Save the result

Decode b64_json and write it to a file:
import base64
from openai import OpenAI

client = OpenAI(base_url="https://api.deepshi.ai/v1", api_key="YOUR_DEEPSHI_API_KEY")

resp = client.images.edit(
    model="deepshi-image-1",
    prompt="remove the person on the left",
    image=open("input.png", "rb"),
)

with open("edited.png", "wb") as f:
    f.write(base64.b64decode(resp.data[0].b64_json))
print("saved edited.png")

Reference images

Most image models support editing. How many reference images each one accepts varies, from 1 up to 14. To send more than one, pass multiple image[] parts:
curl https://api.deepshi.ai/v1/images/edits \
  -H "Authorization: Bearer $DEEPSHI_API_KEY" \
  -F model="deepshi-image-1" \
  -F prompt="combine these into one scene" \
  -F 'image[]=@first.png' \
  -F 'image[]=@second.png'
To see a model’s editing support and its reference-image cap, check the card on the image models page, or read the top-level edit block from GET /v1/models:
"edit": { "supported": true, "max_reference_images": 5 }
deepshi-banana-pro is generate-only and does not support editing. A model that can’t edit has "edit": { "supported": false } in GET /v1/models.

Sizing, parameters, and pricing

An edit request takes the same sizing fields as generation (width and height, aspect_ratio, resolution, or image_size, depending on the model) and the same common parameters. The Deepshi models (deepshi-image-1, deepshi-banana-pro) support only n: 1. Pricing also works the same way as generation, and every response includes usage.cost.total_cost in USD. See Pricing.

Next steps

Image generation

Generate images from a text prompt.

Image models

See which models support editing and how many reference images they take.