Skip to main content
POST
gpt-image-2

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>
default:gpt-image-2
required

Must be one of: gpt-image-2. Defaults to gpt-image-2.

Available options:
gpt-image-2
prompt
string

Length must be between 1 and 32000.

Required string length: 1 - 32000
images
string<url>[]

Up to 10 reference images.

Required array length: 1 - 10 elements
extends.edit.mask
string<url>

Optional mask for local editing; transparent areas are regenerated.

This field's allowed values depend on: images.

size
enum<string>
default:1024x1024

Must be one of: 1024x1024, 1024x1536, 1536x1024, 2048x1152, 2048x2048, 2160x3840, 3840x2160, auto. Defaults to 1024x1024.

Available options:
1024x1024,
1024x1536,
1536x1024,
2048x1152,
2048x2048,
2160x3840,
3840x2160,
auto
quality
enum<string>
default:low

Must be one of: high, low, medium. Defaults to low.

Available options:
high,
low,
medium
max_images
integer
default:1

Must be between 1 and 1. Defaults to 1.

Required range: 1 <= x <= 1
output_format
enum<string>
default:png

Must be one of: png. Defaults to png.

Available options:
png
output_compression
integer

Must be between 0 and 100.

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

Length must be at most 0.

moderation
string

Length must be at most 0.

Response

Business response. code=0 means the task was accepted; validation failures can return HTTP 200 with code=400.

code
enum<integer>
required
Available options:
0
Example:

0

data
object
required
msg
string
required
Example:

"success"

request_id
string<uuid>
Example:

"250b66dd-e1fb-4bb6-b5f6-c668efadc35d"