# Image editing and reference images > Edit a picture or combine several: POST /v1/images/edits (OpenAI's multipart form or JSON) and reference images on generations. Source: https://zurelay.com/docs/image-editing 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 | Endpoint | Takes | Good for | | --- | --- | --- | | `POST /v1/images/edits` | OpenAI’s multipart form (image files), or JSON | OpenAI’s SDKs: client.images.edit(...) | | `POST /v1/images/generations` | JSON with an `images` list | Any HTTP client; images as links or data URLs | Both take the same models, sizes and prices as [generation](https://zurelay.com/docs/images). An edit costs the same as a new image of that size. ## How many images each model takes | Model | ID | Sizes and prices | Reference images | | --- | --- | --- | --- | | [Nano Banana Pro](https://zurelay.com/models/nano-banana-pro) | `nano-banana-pro` | 1K and 2K $0.035 · 4K $0.065 | up to 14 | | [Nano Banana 2](https://zurelay.com/models/nano-banana-2) | `nano-banana-2` | 1K $0.025 · 2K $0.034 · 4K $0.058 | up to 14 | | [GPT Image 2.5 Flare](https://zurelay.com/models/gpt-image-2.5-flare) | `gpt-image-2.5-flare` | $0.02 an image | up to 16 | | [GPT Image 2.5 Sunburst](https://zurelay.com/models/gpt-image-2.5-sunburst) | `gpt-image-2.5-sunburst` | $0.02 an image | up to 16 | | [GPT Image 2](https://zurelay.com/models/gpt-image-2) | `gpt-image-2` | $0.02 an image | up to 16 | ## With OpenAI’s SDKs **Python** (`main.py`): ```python 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) ``` **Node.js** (`index.mjs`): ```javascript import fs from "node:fs"; import OpenAI, { toFile } from "openai"; const client = new OpenAI({ baseURL: "https://api.zurelay.com/v1", apiKey: process.env.ZURELAY_API_KEY }); const result = await client.images.edit({ model: "gpt-image-2", image: [ await toFile(fs.createReadStream("product.png"), null, { type: "image/png" }), await toFile(fs.createReadStream("background.jpg"), null, { type: "image/jpeg" }), ], prompt: "Put the bottle from the first image on the marble counter in the second. Keep its label exactly.", }); console.log(result.data[0].url); ``` **cURL**: ```bash curl https://api.zurelay.com/v1/images/edits \ -H "Authorization: Bearer $ZURELAY_API_KEY" \ -F model=gpt-image-2 \ -F "image[]=@product.png" \ -F "image[]=@background.jpg" \ -F prompt="Put the bottle from the first image on the marble counter in the second." ``` ## As JSON On either endpoint, list the pictures in `images` as links or data URLs (`image` with one picture works too): **Python** (`main.py`): ```python 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()) ``` **Node.js** (`index.mjs`): ```javascript const response = await fetch("https://api.zurelay.com/v1/images/generations", { method: "POST", headers: { Authorization: `Bearer ${process.env.ZURELAY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "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" }), }); console.log(await response.json()); ``` **cURL**: ```bash curl https://api.zurelay.com/v1/images/generations \ -H "Authorization: Bearer $ZURELAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "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" }' ``` ## 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 | Goal | Prompt 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.” |