Skip to main content
POST
Gpt image 2

Authorizations

Authorization
string
header
required

API Key authentication, please include the Authorization field in the request header

Body

multipart/form-data
model
enum<string>
required

GPT Image 2 model and output resolution tier

Available options:
gpt-image-2,
gpt-image-2-2k,
gpt-image-2-4k
Example:

"gpt-image-2"

prompt
string
required

Image generation instructions

Maximum string length: 32000
Example:

"Create a premium product photo on a clean studio background"

size
string

Output aspect ratio. Use auto, one of 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 5:4, or 4:5, or a common WxH pixel size such as 1920x1080 or 512x512. Pixel dimensions are mapped to the nearest supported aspect ratio; delivered dimensions follow the selected model tier.

Example:

"16:9"

n
integer
default:1

Number of images to generate

Required range: 1 <= x <= 10

Response

200 - application/json

Task created successfully

General response

code
integer
required

Response status code: 1000=Success, 9999=Failure, 9000=Insufficient Credits

msg
string
required

Response message

data
object
required

General data response