Skip to main content
POST

Authorizations

Authorization
string
header
required

All APIs require Bearer Token authentication

Add to request header:

Authorization: Bearer YOUR_API_KEY

Body

application/json
model
string
default:gemini-3-pro-image-preview
required

gemini-3-pro-image-preview: Supports text-to-image, image editing, multi-resolution output

Example:

"gemini-3-pro-image-preview"

prompt
string
required

Image generation prompt

Notes:

  • Text-to-image mode: Describe the image content you want to generate
  • Image editing mode: Describe the editing instructions for the reference image
Example:

"A futuristic city skyline at dusk, cyberpunk style"

aspect_ratio
string
default:1:1

Output image aspect ratio

Model differences:

  • gemini-3.1-flash-image-preview: available values include 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, match_input_image
  • gemini-3-pro-image-preview: available values include 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, match_input_image

Notes:

  • match_input_image means the output will try to match the input image's aspect ratio
Example:

"1:1"

resolution
string
default:1K

Output image resolution

Model differences:

  • gemini-3.1-flash-image-preview: supports 512, 0.5K, 1K, 2K, 4K
  • gemini-3-pro-image-preview: supports 1K, 2K, 4K

Notes:

  • 512 and 0.5K both represent half-size output
  • 1K: approximately 1MP
  • 2K: approximately 4MP
  • 4K: approximately 16MP
Example:

"512"

image_urls
string[] | null

Reference/editing image list

Model differences:

  • gemini-3.1-flash-image-preview: supports image-to-image and image editing
  • gemini-3-pro-image-preview: supports image editing

Notes:

  • Automatically switches to image editing mode when provided
  • Publicly accessible image URLs are recommended
Example:
output_format
string | null

Output format

Notes:

  • Both models support this field
  • Common values: jpg, png, webp

Do not pass this parameter unless necessary.

Example:

"png"

google_search
boolean | null

Enable search for real-time information

Notes:

  • Both gemini-3.1-flash-image-preview and gemini-3-pro-image-preview support this field

Do not pass this parameter unless necessary.

Example:

true

image_search
boolean | null

Enable image search to assist generation

Model differences:

  • gemini-3.1-flash-image-preview: supported
  • gemini-3-pro-image-preview: not supported

Do not pass this parameter unless necessary.

Example:

true

Response

Task created successfully

created
integer

Task creation timestamp

Example:

1757165031

id
string

Task ID

Example:

"task-unified-1757165031-uyujaw3d"

model
string

Actual model name used

object
enum<string>

Specific task type

Available options:
image.generation.task
progress
integer

Task progress percentage (0-100)

Required range: 0 <= x <= 100
Example:

0

status
enum<string>

Task status

Available options:
pending,
processing,
completed,
failed
Example:

"pending"

task_info
object

Async task information

type
enum<string>

Task output type

Available options:
image
Example:

"image"