Images

Create an image edit or extension

Changed on

Creates an edited or extended image given an original image and a prompt using the OpenAI-compatible Images API. The request is sent as multipart/form-data with the image file as a binary upload.

Not every provider implements the Images API. Requests routed to a provider that does not support it return 400 Bad Request with an explanatory error message; use /chat/completions for those providers.

post/images/edits

Request

  • Base URL
    http://localhost:8080
  • URL
    http://localhost:8080/images/edits
  • Auth
    HTTP bearer

Query parameters

provider'ollama' | 'ollama_cloud' | 'groq' | 'llamacpp' | 'openai' | 'cloudflare' | 'cohere' | 'anthropic' | 'deepseek' | 'elevenlabs' | 'google' | 'mistral' | 'minimax' | 'moonshot' | 'nvidia' | 'zai' | 'webwright'

Specific provider to use (default determined by model)

Request body multipart/form-data

imagestring binary required

The image to edit. For the GPT image models, a png, webp, or jpg file up to 50MB; for dall-e-2, a square PNG under 4MB. If mask is not provided, the image must have transparency, which will be used as the mask.

promptstring required

A text description of the desired image.

maskstring binary

An additional image whose fully transparent areas (alpha = 0) indicate where the image should be edited. Must be a valid PNG file with the same dimensions as the image (under 4MB for dall-e-2).

modelstring

Model ID to use for image editing.

ninteger

Number of images to generate.

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

The size of the generated images. The GPT image models support 1024x1024, 1536x1024, 1024x1536, and auto; gpt-image-2 also accepts arbitrary WIDTHxHEIGHT values such as 1536x864. dall-e-2 supports 256x256, 512x512, and 1024x1024; dall-e-3 supports 1024x1024, 1792x1024, and 1024x1792.

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

The quality of the edited image. auto selects the best quality for the model. The GPT image models support low, medium, and high; dall-e-2 supports only standard.

response_format'url' | 'b64_json'

The format in which the generated images are returned.

Response

Successful response

createdinteger required

The Unix timestamp (in seconds) of when the image was created.

Changes