Images

Image editing and reference images

Give an image model pictures to work from: edit a photo, put a product in a new scene, keep a character the same across shots, or blend several images into one.

Two ways to send images

EndpointTakesGood for
POST /v1/images/editsOpenAI’s multipart form (image files), or JSONOpenAI’s SDKs: client.images.edit(...)
POST /v1/images/generationsJSON with an images listAny HTTP client; images as links or data URLs

Both take the same models, sizes and prices as generation. An edit costs the same as a new image of that size.

How many images each model takes

ModelIDSizes and pricesReference images
Nano Banana Pronano-banana-pro1K and 2K $0.035 · 4K $0.065up to 14
Nano Banana 2nano-banana-21K $0.025 · 2K $0.034 · 4K $0.058up to 14
GPT Image 2.5 Flaregpt-image-2.5-flare$0.02 an imageup to 16
GPT Image 2.5 Sunburstgpt-image-2.5-sunburst$0.02 an imageup to 16
GPT Image 2gpt-image-2$0.02 an imageup to 16

With OpenAI’s SDKs

import os
from openai import OpenAI
client = OpenAI(base_url="https://api.zurelay.com/v1", api_key=os.environ["ZURELAY_API_KEY"])
result = client.images.edit(
model="gpt-image-2",
image=[open("product.png", "rb"), open("background.jpg", "rb")],
prompt="Put the bottle from the first image on the marble counter in the second. Keep its label exactly.",
)
print(result.data[0].url)

As JSON

On either endpoint, list the pictures in images as links or data URLs (image with one picture works too):

import os
import requests
response = requests.post(
"https://api.zurelay.com/v1/images/generations",
headers={"Authorization": f"Bearer {os.environ['ZURELAY_API_KEY']}"},
json={
"model": "nano-banana-pro",
"prompt": "Make the jacket in the first image deep green, and give the model the pose from the second.",
"images": [
"https://example.com/model.jpg",
"data:image/png;base64,iVBORw0KGgo..."
],
"size": "2K",
"aspect_ratio": "4:5"
},
)
response.raise_for_status()
print(response.json())

Rules for input images

  • PNG, JPEG or WebP, up to 20 MB each.
  • Links must be public https URLs; we download them ourselves. One that doesn’t download is refused with invalid_image before anything is made.
  • Refer to images by their order in the prompt: “the first image”, “the second image”.
  • Masks aren’t supported. Describe the change instead (“replace only the sky”); these models edit just what you name.
  • Over a model’s limit, the request is refused with a clear error naming the limit.

What to try

GoalPrompt pattern
Edit one thing“Change the car to matte black. Keep everything else the same.”
New background“Place the person from the image on a beach at sunset, matching the light.”
Product in a scene“Put the product from the first image on the shelf in the second.”
Same character, new shot“The same woman as in the references, now riding a bike in Paris.”
Style transfer“Redraw the first image in the style of the second.”
Combine many“A group photo of the six people in the images, standing on stairs.”

Questions, or something missing? Ask support in your dashboard or email support@zurelay.com.