Edit an image from a prompt
Edits an input image as a text prompt asks, in the OpenAI Images shape, and returns the result inline as base64. In preview for selected organizations. Call it with a model whose supported_apis on GET /v1/models include images_edits; the model's images block lists its sizes and limits. Send multipart/form-data with the image as a file part, as the OpenAI SDKs do, or application/json with the image as a base64 data URL. Input images are PNG, JPEG or WebP, at most 10 MiB each; a URL to fetch, a file id and a mask are refused with unsupported_value. With size auto or no size, the output takes the model's size nearest the input image's aspect ratio, read after the image's EXIF orientation is applied, so a portrait photo comes back portrait; the response's size names it. Sizes are a closed list per model: a size off it is refused with invalid_size. Never streams. Requires a funded balance. Billed on the output pixels delivered (usage.pixels) at the model's price per megapixel; input images are not billed. A request returns all n images or an error and bills nothing on an error, a content policy refusal included. The prompt, the input images and every output pass content checks that a request cannot adjust. The request body is capped at 16 MiB.
Required permission
Requires the inference.invoke permission. See Permissions for the roles and API key permissions that include it.
Command line
The orl CLI wraps this endpoint:
Guided workflow: orl images edit
orl images edit --image <image> --model <model> --prompt <prompt>apiKeyAuthorizationBearer <token>OpenRelay API key. Send it as Authorization: Bearer or_… (legacy vl_… keys still work).
- body
An OpenAI Images edits request as multipart/form-data, the form the OpenAI SDKs send. Every field of the JSON form is a form field of the same name and meaning, except the input images, which are file parts: one part named image, or one part named image[] per image. A mask part is refused with unsupported_value.
model*stringAn OpenRelay public model id whose supported_apis include images_edits.
prompt*stringThe edit to make, up to the model's prompt limit (prompt_too_long over it).
image?fileThe input image, when there is one: a PNG, JPEG or WebP file of at most 10 MiB. Send this or image[], at least one image in all.
binaryimage[]?array<>The input images, one part each, 1 to the model's limit (too_many_images outside it). An error about one names it as images[i], counting from 0.
n?integerImages to return, 1 to the model's limit (invalid_n outside it). Default 1. A request returns all n images or an error, never fewer.
1 <= valuesize?stringauto, or one of the model's sizes as WxH (invalid_size otherwise). auto and absence take the model's size nearest the first input image's aspect ratio, read after the image's EXIF orientation is applied; the response's size names it.
response_format?"b64_json"b64_json only; url is refused with unsupported_value.
"b64_json"output_format?ImageRequestOutputFormatEncoding of each image. Default png.
"png""jpeg""webp"output_compression?ImageRequestOutputCompressionCompression for jpeg and webp; ignored for png.
0 <= value <= 100seed?ImageRequestSeedSeed of the first image; image i of the request uses seed + i, wrapping past 4294967295 to 0. The server picks one when absent. Each image's seed is returned in data.
int640 <= value <= 4294967295background?ImageRequestBackgroundauto and opaque are accepted; transparent is refused with unsupported_value.
"auto""opaque""transparent"input_fidelity?ImageRequestInputFidelityAccepted and ignored.
quality?ImageRequestQualityAccepted and ignored: steps are fixed per model, so the price is known before the run.
moderation?ImageRequestModerationAccepted and ignored: the content checks are not adjustable.
stream?ImageRequestStreamfalse or absent; true is refused with unsupported_value.
partial_images?ImageRequestPartialImages0 or absent; any other value is refused with unsupported_value.
user?ImageRequestUserAccepted, not forwarded and not stored.
safety_identifier?stringAccepted, not forwarded and not stored.
OK
application/json- response
An images response. Every image is inline base64.
created?integerUnix timestamp (seconds) the images were made.
int64data?array<>The images, n of them, in order.
output_format?stringThe encoding of every image.
"png""jpeg""webp"size?stringThe size every image was made at, WxH. For a request sent with size auto or none, the size it resolved to.
usage?OpenRelay's own image usage: no token counts.
openrelay?What the request is billed, on every online inference response.
curl -X POST 'https://inference.openrelay.inc/v1/images/edits' \ -H 'Content-Type: application/json' \ -d '{ "model": "string", "prompt": "string", "images": [ { "image_url": "string" } ]}'{ "created": 0, "data": [ { "b64_json": "string", "seed": 0 } ], "output_format": "png", "size": "string", "usage": { "images": 0, "pixels": 0 }, "openrelay": { "cost_nano_usd": 0, "priced_at": "string" }}Overview
Edit images in the OpenAI Images shape, billed per output megapixel. In preview: available to selected organizations. Served by the inference endpoint (inference.openrelay.inc).
Overview
Batch inference jobs: submit a JSONL file of requests, poll status, and download results. A batch has 24 hours to finish; standard batches bill at a discount. Served by the inference endpoint (inference.openrelay.inc). Batch access is enabled per organization; without it these endpoints return 404.