Skip to main content
POST
Image generation

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

Required. Gemini picture model. See the interface description for the resolution, search, thinking and reference map limitations of different models.

Available options:
gemini-3.1-flash-image,
gemini-3-pro-image,
gemini-2.5-flash-image
Minimum string length: 1
prompt
string
required

Required. Generate prompt words for pictures.

Required string length: 1 - 32000
images
(string | object)[]

Optional. Reference image array; at least 1 image is used for image editing. URL/data URL string or object containing image_url can be passed; file_id is not supported. See the interface description for the upper limit of the model.

Required array length: 1 - 14 elements
size
enum<string>

Output aspect ratio. The gateway reduces and maps this field to Gemini aspectRatio; it is not a pixel dimension. Extreme ratios 1:4, 4:1, 1:8, 8:1 are only supported by gemini-3.1-flash-image.

Available options:
1:1,
1:4,
1:8,
2:3,
3:2,
3:4,
4:1,
4:3,
4:5,
5:4,
8:1,
9:16,
16:9,
21:9
quality
enum<string>

Output resolution mapping: low→512px, standard→1K, medium→2K, high/hd→4K, auto/omitted→not specified. gemini-2.5-flash-image only supports 1K.

Available options:
standard,
hd,
low,
medium,
high,
auto

Gemini native extension, whether to enable Google Search grounding; only available for models that support this capability.

Gemini native extension, whether to enable image search grounding; only available for models that support this capability.

thinking_level
enum<string>

Gemini native extension, model thinking intensity; only models that support this capability are available.

Available options:
Minimal,
High
response_format
enum<string>
default:b64_json

Fixed returning Base64 image so that the response conforms to the Response Schema of this interface.

Available options:
b64_json,
url

Response

200 - application/json
created
integer
required

Unix timestamp in seconds when the image was created.

data
object[]
required

Generate a list of results.

background
enum<string>

The actual background settings used.

Available options:
transparent,
opaque
output_format
enum<string>

Actual output image format.

Available options:
png,
webp,
jpeg
quality
enum<string>

Actual build quality.

Available options:
low,
medium,
high
size
string

The actual resulting image size.

usage
object

The token usage of the GPT Image model.