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. 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
The response is the same as generation. The edited image is base64-encoded in data[0].b64_json:

Step 2: Save the result

Decode b64_json and write it to a file:

Reference images

Most image models support editing. How many reference images each one accepts varies, from 1 up to 14; sending more than a model accepts returns 400. To send more than one, pass multiple image[] parts:
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:
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.