POST /v1/images/edits
Generates an edited version of an image based on a text prompt. You can optionally supply a mask image to restrict edits to a specific region. The request body must be sent asmultipart/form-data.
This endpoint is currently supported for providers that expose an
imageEdit operation, such as OpenAI (dall-e-2).Request headers
The provider to route the request to (e.g.
openai). Required when not using a config.Your provider API key.
A JSON config object or config ID that defines routing, fallbacks, retries, and more.
A virtual key ID from Portkey Cloud.
Request body
This endpoint accepts
multipart/form-data. The image and mask must be uploaded as file fields, not JSON.The source image to edit. Must be a valid PNG file, less than 4 MB, and square. The image must have an alpha channel (transparency) to indicate the area to edit.
A text description of the desired edit. Maximum 1000 characters.
An optional PNG mask image that defines which areas to edit. Fully transparent areas (alpha = 0) are edited; fully opaque areas are preserved. Must be the same size as the source image.
The model to use for image editing.
The number of edited images to generate. Must be between 1 and 10.
The size of the generated images. One of
256x256, 512x512, or 1024x1024.The format of the response. One of
url or b64_json.A unique identifier for the end user.
Response
Unix timestamp of when the images were created.
An array of generated image objects.