POST
Create 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

application/json

Image generation request

prompt
string
required

Prompt

Maximum string length: 32000
Example:

"a cat wearing a spacesuit"

model
string
required

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

Minimum string length: 1
Example:

"openai/gpt-image-2"

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

moderation
string

Moderation level: low / auto

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)

style
string

Style: vivid / natural

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

Response

OK

The response is of type object.