Image editing
POST /v1/images/edits takes one or more reference images plus a prompt and returns a new image. Use it when you already have the picture and want to change it. To generate an image from text alone, use image generation.
The request is multipart/form-data, not JSON, because it carries files. The response has the same shape as /v1/images/generations: the edited image arrives as base64 in data[0].b64_json.
The OpenAI SDK’s images.edit works against the https://api-gateway.merge.dev/v1 base URL. The /v1/openai base URL does not serve the image endpoints.
Request fields
Streaming partial images is not supported; stream=true fails with 400 stream_unsupported. Model aliases resolve on the chat surfaces only, so name the canonical model.
Model support and limits
An edit needs a route that lists image in both capabilities.input and capabilities.output on GET /v1/models. A text-only image model rejects an edit with 400 image_input_unsupported before any provider call. Filter by image input and image output in the model catalog for the current list.
Pricing
Uploaded images bill as image-input tokens at the route’s image-input rate (pricing.input_image_per_million on GET /v1/models); the prompt bills at the text-input rate and the output image at the image-output rate, as on /v1/images/generations. The response usage.input_tokens_details carries the image_tokens and text_tokens split, and cost is the server-computed USD amount for the request.