Create gpt-image-2
POST
/v1/images/generations
- Generate images from a text
prompt(gpt-image-2) - Supports output parameters such as
size,format, andquality - Request body is
application/json - Official docs: Images create
Authorizations
bearer
Type
HTTP (bearer)
Request Body
application/json
model
string
Required
Model used to generate images, e.g. gpt-image-2.
prompt
string
Required
A text description of the desired image. Maximum length is 1000 characters.
n
integer
Number of images to generate. Must be between 1 and 10.
size
string
Image dimensions
1024x1024 square
1536x1024 landscape
1024x1536 portrait
2048x2048 2K square
2048x1152 2K landscape
3840x2160 4K landscape
2160x3840 4K portrait
auto default
Size constraints
- Maximum edge length ≤ 3840px
- Both width and height must be multiples of 16px
- Long edge / short edge ratio ≤ 3:1
- Total pixels: minimum 655360 ~ maximum 8294400
format
string
Image format
Options: png, jpeg, webp
quality
string
Image quality
Options: low, medium, high, auto (default)
Responses
application/json
object
id
string
Required
object
string
Required
created
integer
Required
choices
object[]
Required
usage
object
Required