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
string
required

Required. Use a model ID or available alias returned by Get Models.

Minimum string length: 1
Examples:

"gemini-3.1-flash-image"

"gemini-3-pro-image"

"gemini-2.5-flash-image"

prompt
string
required

Required. Describe the image to generate.

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

Optional reference images for image-to-image generation. Omit for text-to-image generation. Image limits depend on the selected model.

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

Output size as WIDTHxHEIGHT, or auto for the model default. Supported sizes depend on the selected model.

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 quality. Supported values depend on the selected model.

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:url

Response format: url returns image URLs; b64_json returns Base64 image data.

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.