Skip to content

Image edits & reference images

You can guide generation with one or more reference images, for example to restyle a photo or keep a product's look consistent.

POST https://api.yexapi.com/v1/images/edits

The body is JSON and reference images are passed as public http(s) URLs in image (a string or an array, up to 14 images):

curl https://api.yexapi.com/v1/images/edits \
  -H "Authorization: Bearer $YEXAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Turn this mug into a pastel blue glazed mug, keep everything else the same",
    "image": ["https://example.com/my-mug.png"],
    "size": "1024x1024"
  }'

The response has the same format as synchronous generation.

You can also add image to POST /v1/images/generations or POST /v1/images/generations/async; the behaviour and price are the same.

Limitations

  • Multipart file uploads are not supported. The OpenAI SDK's images.edit(image=open(...)) sends multipart data and will be rejected with 400. Upload the file to your own storage (or any public URL) first and pass the URL.
  • Base64 / data: URLs are not accepted.
  • mask is not supported.
  • The URL must be reachable from the public internet. If it cannot be downloaded, the task fails and is refunded.