Edit an image
Images
Edit an image
OpenAI-compatible image editing endpoint.
Accepts EITHER ``multipart/form-data`` (binary uploads: ``image``, optional
``mask``, ``reference_images``) OR ``application/json`` whose image fields are
data-URL / base64 strings (or ``{"url": ...}`` objects) — the same convention
as the chat ``image_url``. Remote http(s) URLs are rejected (mesh does not
server-side-fetch images); send a ``data:image/<fmt>;base64,<data>`` URL.
Supports ``operation`` in {edit, remove_background, upscale, outpaint, mix,
reframe, inpaint}. Each op is gated by the resolved model's supports_image_<op>
flag (422 when unset / unsupported); the legacy provider matrix is a
transitional backstop for the original four ops.
- ``edit`` (default): openai, byteplus, vertex — prompt + image (+ optional mask + refs).
- ``remove_background``: openai, vertex — image only; prompt optional.
- ``upscale``: vertex (Imagen) or byteplus (Seedream Smart Upscale) — image +
upscale_factor (x2|x4; Seedream maps x2→2k, x4→4k).
- ``outpaint``: vertex — image + prompt + mask (defines expansion region).
- ``mix``: Gemini image models + gpt-image (openai) — prompt + image + 1-3
reference_images (2-4 sources composed into one, sent as image[]); single
output.
- ``reframe``: Gemini image models — image + aspect_ratio
(1:1|3:4|4:3|9:16|16:9|2:3|3:2); recomposes by outpainting to the target
ratio; single output.
- ``inpaint``: openai, vertex — image + mask (canonical WHITE=edit; mesh
normalizes per provider). Optional mask_feather blends the result back
through the mask (Pillow; 501 if unavailable).
> **Note:** The image response may not render in GitBook's "Test it" panel.
> To view the edited image, try this endpoint with Postman, curl, or another
> HTTP client.
POST
Edit an image
Authorizations
Enter your MeshAPI key (rsk_...) — sent as Authorization: Bearer <key>.
Headers
Dated version of the API contract to pin this request to. Omit it and the request is served under 2026-08 — the oldest supported version, so an existing integration is never moved by a release. A malformed or unsupported value is rejected with 400 invalid_api_version rather than falling back silently. The version actually served is echoed as X-Mesh-Version on every response, including errors.
Available options:
2026-08 Response
The edited image(s).