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
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
With OpenAI’s SDKs
main.py
import osfrom openai import OpenAIclient = 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):
main.py
import osimport requestsresponse = 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
httpsURLs; we download them ourselves. One that doesn’t download is refused withinvalid_imagebefore 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
Questions, or something missing? Ask support in your dashboard or email support@zurelay.com.