POST
Edit images

Authorizations

Authorization
string
header
required

Provide your API key in the Authorization header using Bearer auth

Headers

Prefer
string

Set to respond-async to process asynchronously: returns 202 with a Generation object right away; poll GET /v1/generations/{id} for the result

Idempotency-Key
string

Idempotency key for asynchronous requests (up to 255 characters): the same key in the same project is accepted only once, and a repeat returns the existing generation

Body

Image edit multipart form: the JSON fields as form fields (generation_config and metadata as JSON strings) plus reference image files

prompt
string
required

Prompt

Maximum string length: 32000
Example:

"make the sky orange"

model
string
required

Model ID (author/model). See GET /v1/models?type=image

Minimum string length: 1
Example:

"openai/gpt-image-2"

images
object[]

Reference images for JSON requests (up to the model's max_reference_images); multipart requests upload files as image / image[] instead

Maximum array length: 16
n
integer<int32>

Number of images, 1-10

Required range: 1 <= x <= 10
Example:

1

quality
string

Quality: low / medium / high / auto …; affects price

Example:

"medium"

size
string

Size, e.g. 1024x1024, 1536x1024 or auto

Example:

"1024x1024"

response_format
string

Response format: url (default, signed link) / b64_json

Example:

"url"

background
string

Background: transparent / opaque / auto

input_fidelity
string

How closely to follow the reference images: high / low

output_compression
integer<int32>

Output compression 0-100 (jpeg / webp)

Required range: 0 <= x <= 100
output_format
string

Output format: png / jpeg / webp

partial_images
integer<int32>

Partial images when streaming (streaming not supported yet)

stream
boolean

Whether to stream (not supported yet)

user
string

End-user identifier for abuse detection

generation_config
object

Image generation parameters

metadata
object

Caller-defined data (up to 16 keys), shown in billing

image
file[]

Reference image files (png / jpeg / webp / gif, up to 20 MB each): image for one file, image[] for several

Response

OK

The response is of type object.