Skip to main content

Endpoint

Generate images using Google’s Imagen 3 engine through an OpenAI-compatible interface. Supports custom sizes, quality levels, and aspect ratios.

Authentication

string
required
Bearer token authentication

Request Headers

string
required
Must be application/json

Request Body

string
required
Image model identifier:
  • gemini-3-pro-image - Standard image generation
  • gemini-3.1-flash-image - Fast image generation
  • gemini-3-pro-image-16-9-4k - With aspect ratio and quality suffix
string
required
Text description of the image to generate
Be descriptive! Include style, mood, composition, and details for best results.
string
Image size in WIDTHxHEIGHT format or aspect ratio:
  • Exact dimensions: 1920x1080, 1024x1024, 1280x720
  • Aspect ratios: 16:9, 9:16, 4:3, 3:4, 21:9, 1:1
Auto-calculates aspect ratio from exact dimensions.Default: 1024x1024 (1:1 aspect ratio)
string
Image quality level:
  • hd - 4K resolution (highest quality)
  • medium - 2K resolution
  • standard - Default resolution (1K)
Default: standard
string
Direct Gemini native resolution parameter (takes precedence over quality):
  • 4K - 4096px maximum dimension
  • 2K - 2048px maximum dimension
  • 1K - 1024px maximum dimension
imageSize has higher priority than quality. If both are set, imageSize is used.
integer
Number of images to generate (1-10)Default: 1
string
Response format:
  • b64_json - Base64-encoded JSON (recommended)
  • url - Data URI format
Default: url
string
Person generation policy:
  • allow - Allow person generation
  • deny - Block person generation
Default: allow

Response Format

integer
Unix timestamp of generation
array
Array of generated images

Example: Basic Generation

Example: Python SDK

Example: Multiple Sizes

Example: Native imageSize Parameter

Alternative: Chat API Format

You can also generate images via the Chat Completions endpoint:

Alternative: Claude Messages API Format

Model Suffix Format

You can specify aspect ratio and quality directly in the model name:
Suffix patterns:
  • Aspect ratio: -16-9, -9-16, -4-3, -3-4, -21-9, -1-1
  • Quality: -4k, -2k (no suffix = standard)
Examples:
  • gemini-3-pro-image-16-9-4k → 16:9 + 4K
  • gemini-3-pro-image-1-1-2k → Square + 2K
  • gemini-3-pro-image-21-9 → Ultrawide + Standard

Supported Sizes

Exact Dimensions

Aspect Ratios

Quality Levels

Parameter Priority

When multiple size/quality parameters are provided:
  1. Highest priority: imageSize parameter (4K, 2K, 1K)
  2. Medium priority: quality parameter (hd, medium, standard)
  3. Lowest priority: Model suffix (-4k, -2k)
Example:

Prompt Engineering Tips

Be Specific

❌ Bad: “A city” ✅ Good: “A futuristic cyberpunk city at night with neon signs, rain-slicked streets, and flying vehicles”

Include Style

  • Art style: “digital art”, “oil painting”, “watercolor”, “3D render”
  • Artist reference: “in the style of Studio Ghibli”, “Greg Rutkowski style”
  • Mood: “moody”, “vibrant”, “minimalist”, “dramatic lighting”

Structure

Good prompt structure:
  1. Subject: What to generate
  2. Style: Artistic style/medium
  3. Details: Colors, composition, lighting
  4. Quality: “highly detailed”, “8k”, “photorealistic”
Example:

Error Handling

Quota Management

Image generation consumes quota from the configured account. Antigravity Manager:
  • Automatically refreshes quota after successful generation
  • Rotates accounts when quota is exhausted
  • Displays real-time quota in the dashboard

Features

  • Flexible Sizing: Supports both exact dimensions and aspect ratios
  • Quality Control: Three quality levels (1K/2K/4K)
  • Multi-format: Base64 JSON or Data URI output
  • Batch Generation: Generate up to 10 images per request
  • Auto Quota Refresh: Real-time quota updates
  • Multiple Protocols: Works with OpenAI, Claude, and Chat APIs
  • Smart Defaults: Sensible defaults for quick testing

Limitations

  • Maximum 10 images per request (n parameter)
  • Custom sizes auto-mapped to supported aspect ratios
  • Person generation controlled by safety settings
  • Quota varies by account tier (Pro/Ultra/Free)