Edit an image (OpenAI-compatible)
Accepts multipart/form-data (with a reference image) or JSON. Billed per call.
For openai/gpt-image-2.5-sunburst 2K / 4K edits, send up to 10 reference images as multipart image / image[], or as JSON image / images (https URLs or data URLs; images:[{image_url}] is also accepted).
Per-model limits (openai/gpt-image-2.5-sunburst, openai/gpt-image-2.5-flare, openai/gpt-image-2):
- Standard
size:auto(default),1024x1024,1536x1024,1024x1536. Output is about 1.5 MP;sizeonly sets the aspect ratio andqualitydoes not change the output or the price. Other sizes return 400. n: up to 4 foropenai/gpt-image-2; 1 for flare and sunburst.- The response is always
{created, data:[{b64_json}]}(base64 PNG);response_formathas no effect. openai/gpt-image-2.5-sunburst2K / 4K:2048x2048,2560x1440,1440x2560or"2K"= 2K at $0.08 per image;3840x2160,2160x3840or"4K"= 4K at $0.12 per image (standard is $0.0186). 2K / 4K requiresn= 1, ignoresquality, does not supportmask, and is never retried or served by a backup model. Unlisted sizes return 400 and are not charged.
xai/grok-imagine-image-2.0: send one source image as JSON image ({"url": ...}, an https URL or a data URL), up to 3 as JSON images, or as multipart image / image[]. With several images, refer to them in the prompt as <IMAGE_0>, <IMAGE_1> and so on. For edits quality defaults to medium (auto means medium); resolution and n work as for generations, and there is no mask. Billed per output image by quality × resolution, plus each source image once per request. More than 3 source images return 400 before anything is billed.
See Images: Parameters vs. OpenAI for the full list of supported and unsupported parameters.
Authorization
bearerAuth Authorization: Bearer <your RouteMux API key>.
Create keys at https://routemux.com/console/keys. New keys use the sk- prefix;
the legacy rmx_live_ prefix is still accepted.
The Anthropic SDK's x-api-key and the Google SDK's x-goog-api-key are accepted too.
Sending several key headers with different values returns 400 AUTH_AMBIGUOUS_API_KEY.
In: header
TypeScript Definitions
Use the request body type in TypeScript.
Request and response bodies match the upstream provider's official format verbatim —
RouteMux passes them through untouched. See the provider's own docs for field definitions;
the gateway itself only reads model and stream.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/images/edits" \ -H "Content-Type: application/json" \ -d '{}'{ "model": "string", "stream": true}