Edit an existing image from a prompt and one or more reference images.
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.
Endpoint
What it does
POST /v1/images/edits
Edit 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.
import base64from openai import OpenAIclient = 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")
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:
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.