Skip to main content
POST
Generate image

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

Must be gpt-image-2.

Available options:
gpt-image-2
Example:

"gpt-image-2"

prompt
string
required

Text description of the desired image.

Example:

"A serene koi pond at sunset, ukiyo-e style"

n
integer
default:1

Number of images to generate.

Required range: 1 <= x <= 4
size
string
default:1024x1024

{width}x{height}. Edges must be multiples of 16, aspect ratio <= 3:1, total pixels 655,360-8,294,400, max edge 3,840px.

quality
enum<string>
default:medium

Rendering quality.

Available options:
low,
medium,
high
output_format
enum<string>
default:png

Output image format.

Available options:
png,
webp,
jpeg
moderation
enum<string>
default:auto

Content moderation strictness.

Available options:
auto,
low
output_compression
integer

Compression level for jpeg/webp output.

Required range: 0 <= x <= 100

Response

Images generated successfully

created
integer

Unix timestamp of the generation.

data
object[]
usage
object