Images

Edit an image

Edits an image using a text prompt and optional mask. Request must be sent as multipart/form-data with at least model, prompt (unless type is background_removal), and image (or image[]).

post/v1/images/edits

Request

Request body multipart/form-data

modelstring required

Model identifier in format provider/model

promptstring

Text prompt describing the edit. Required unless type is background_removal.

imagestring binary required

Image file to edit. Use field name image for a single file or image[] for multiple files.

maskstring binary

Optional mask image for inpainting (transparent areas indicate regions to edit)

type'inpainting' | 'outpainting' | 'background_removal'

Type of edit operation

ninteger

Number of images to generate

size'256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto'

Size of the output image

response_format'url' | 'b64_json'

Format of the response

streamboolean

When true, stream the response via Server-Sent Events

background'transparent' | 'opaque' | 'auto'

Background type for the image

input_fidelity'low' | 'high'

How closely to follow the original image

partial_imagesinteger

Number of partial images to generate when streaming

quality'auto' | 'high' | 'medium' | 'low' | 'standard'

Quality of the output image

output_format'png' | 'webp' | 'jpeg'

Output image format

num_inference_stepsinteger

Number of inference steps

seedinteger

Seed for reproducible editing

output_compressioninteger

Compression level (0-100%)

negative_promptstring

What to avoid in the edit

userstring

User identifier for tracking

Response

Successful response. Returns JSON for non-streaming requests, or Server-Sent Events (SSE) stream when stream=true. When streaming, events are sent with the following event types:

  • image_edit.partial_image: Intermediate image chunks with base64-encoded image data
  • image_edit.completed: Final event for each image with usage information
  • error: Error events with error details
idstring

Unique identifier for the generation request

createdinteger

Unix timestamp when the image was created

modelstring

Model used for generation

backgroundstring

Background type for the image

output_format'png' | 'webp' | 'jpeg'

Output image format

qualitystring

Quality of the generated image

size'256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792' | '1536x1024' | '1024x1536' | 'auto'

Size of the generated image

Changes

No recorded changes to this operation across all 1 revision of this API.