Skip to Content
Cheapest Imagen
Guides

Edit images

Image to image with the Cheapest Imagen API. Send one or more reference images to /v1/images/edits with GPT Image or Nano Banana, as files or as links, and describe the change.

Send a prompt and one or more reference images to POST /v1/images/edits. Every model takes reference images, and an edit costs the same credits as a new image.

Upload files

Send the request as a form. Repeat image[] for each reference image.

curl https://api.cheapestimagen.com/v1/images/edits \
  -H "Authorization: Bearer $YOUR_KEY" \
  -F model=nano-banana-2.1 \
  -F prompt="put the product on a marble table, soft daylight" \
  -F "image[]=@product-front.png" \
  -F "image[]=@product-side.png" \
  -F size=2048x2048 \
  -F response_format=url

With the OpenAI SDK:

from openai import OpenAI

client = OpenAI(base_url="https://api.cheapestimagen.com/v1", api_key="YOUR_KEY")
result = client.images.edit(
    model="gpt-image-2.6",
    image=[open("portrait.png", "rb")],
    prompt="change the jacket to dark green, keep the face and the background",
    response_format="url",
)
print(result.data[0].url)

Send JSON with an images array. Each item has an image_url, which is an https: link or a base64 data: URL.

curl https://api.cheapestimagen.com/v1/images/edits \
  -H "Authorization: Bearer $YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-pro",
    "prompt": "turn this sketch into a watercolour illustration",
    "images": [{ "image_url": "https://example.com/sketch.png" }]
  }'

file_id is not supported; pass image_url.

Limits

Reference images per request1 to 16
Size of one imageup to 20 MB
Size of the whole requestup to 50 MB
File typesPNG, JPEG, WebP

A request over these limits returns 413.

Options

Every option of text to image works on edits: n, size, quality, output_format, response_format. One more is for edits only:

FieldWhat it doesValues
input_fidelityHow closely the result keeps the details of the reference imageslow (default), high. Works on GPT Image 2.5 and 2.6 and their flare and sunburst versions; other models return 400

What is not supported

  • Masks. You cannot repaint one area only. Describe in the prompt what must stay the same.
  • Transparent backgrounds. background: transparent returns 400 on every model.

Tips

  • Send more than one angle of the subject when it must stay the same.
  • Say what must not change: “keep the label unchanged”, “same face and hairstyle”.
  • For 2K and 4K output use Nano Banana, gpt-image-2-adobe, or a flare or sunburst version. See Ratios and sizes.

On this page