Skip to main content
POST
Generate or edit an image with Gemini
Use the normalized GENGEN request schema with one of these public model IDs:
  • gemini-nano-banana-2.1
  • gemini-3-pro-image
  • gemini-3.1-flash-image
  • gemini-3.1-flash-lite-image

Text-to-image request

Image editing request

Add public or signed HTTPS URLs, or Base64 data URLs, under assets.referenceImages. Raw gs:// URIs are not accepted; use a signed HTTPS URL instead.

Response

Read generated media from outputs.images. Generated images are returned as HTTPS URLs, not Base64. Each URL is retained for 24 hours. The response fields are shown below.
Generated image URLs expire after 24 hours. Download or copy every image to storage you control before outputs.expiresAt.

Parameters

GENGEN fixes candidateCount to 1; request multiple alternatives with separate calls. Reference image formats are PNG, JPEG, WebP, HEIC, and HEIF.
Supported sizes vary by model: Nano Banana 2.1 supports 1K, 2K, and 4K; Nano Banana Pro (Gemini 3 Pro Image) supports 1K, 2K, and 4K; Nano Banana 2 (Gemini 3.1 Flash Image) supports 512, 1K, 2K, and 4K; Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) supports 1K.
See the Google model pages for detailed capabilities.

Nano Banana 2.1 controls

For gemini-nano-banana-2.1, set controls.size to 1K, 2K, or 4K (default 1K). Thinking defaults to MEDIUM; set providerOptions.google.generationConfig.thinkingConfig.thinkingLevel to MINIMAL, MEDIUM, or HIGH. The maximum output budget is 32,768 tokens. seed, temperature, topP, topK, and log-probability parameters are unsupported and rejected before generation. This endpoint exposes text and reference-image inputs; video input, grounding, and multi-turn conversation state are not supported.

Authorizations

Authorization
string
header
required

A workspace API key beginning with gengen_live_.

Body

application/json
model
enum<string>
required

Google native image model ID.

Available options:
gemini-nano-banana-2.1,
gemini-3-pro-image,
gemini-3.1-flash-image,
gemini-3.1-flash-lite-image
prompt
string
required

Generation or editing instruction.

assets
object
controls
object
providerOptions
object

Response

The generated image URLs and their expiry time.

id
string
required
model
string
required
status
string
required
Allowed value: "succeeded"
outputs
object
required