Skip to main content
MonoRelay exposes three image endpoints that mirror the OpenAI Images API: generating new images from text prompts, creating variations of an existing image, and editing an image using a masked region with an inpainting prompt. All three endpoints route through the same provider resolution logic as the rest of the API, so you can point them at any configured provider that supports image capabilities.

POST /v1/images/generations

Generate one or more images from a text prompt.

Authentication

Request body

string
required
The image generation model to use (e.g. dall-e-3, dall-e-2). Accepts aliases and model@provider syntax.
string
required
A text description of the desired image. For DALL-E 3, prompts up to 4000 characters are supported.
integer
default:"1"
Number of images to generate. For DALL-E 3 this must be 1. For DALL-E 2, up to 10 images can be requested.
string
Image dimensions. Accepted values depend on the model — for DALL-E 3: "1024x1024", "1792x1024", or "1024x1792". For DALL-E 2: "256x256", "512x512", or "1024x1024".
string
default:"url"
Output format for the generated image: "url" (a temporary CDN link) or "b64_json" (base64-encoded PNG data). Not all providers support both formats.

Example


POST /v1/images/variations

Create variations of an existing image. The request is sent as multipart/form-data.

Request parameters

file
required
The source image to vary, uploaded as a multipart file field. Must be a PNG, less than 4 MB, and square.
string
required
The model to use for generation.
integer
default:"1"
Number of variations to generate.
string
Output image size. Same accepted values as /generations.
string
default:"url"
Output format: "url" or "b64_json".

Example


POST /v1/images/edits

Edit an image by providing a mask that defines the region to regenerate, along with a text prompt describing the replacement content. The request is sent as multipart/form-data.

Request parameters

file
required
The original image to edit. Must be a square PNG, less than 4 MB, with an alpha channel (transparency) used as the edit mask when no separate mask file is provided.
file
An optional separate mask image. Transparent pixels indicate where the image should be edited. Must be the same size as image.
string
required
The model to use for inpainting.
string
required
A text description of what should appear in the masked area.
integer
default:"1"
Number of edited images to generate.
string
Output image size.
string
default:"url"
Output format: "url" or "b64_json".

Example


Response format

All three endpoints return the same response structure:
When response_format is "b64_json", the url field is replaced with b64_json containing the raw PNG data encoded as a base64 string. The revised_prompt field is only present for DALL-E 3 responses.