Gemini-3.1-Flash-Image-preview (Nano banana2)
Gemini-3.1-Flash-Lite-Image (Nano Banana Lite) Image Generation
- The fastest and cheapest image model in the Gemini 3.1 family, designed for large-scale, low-cost image generation
- Supports 1K resolution only (passing 2K/4K/0.5K is automatically downgraded to 1K without an error)
- Supports text-to-image and image-to-image, up to 14 reference images
- Billed by input / output tokens; connects directly to the official Gemini channel, with asynchronous task-based image generation
POST
Authorizations
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Body
Image generation model nameAlways use this model name:
gemini-3.1-flash-lite-image (Nano Banana Lite)This model connects directly to the official Gemini channel, has no
-official variant, and does not support the official_fallback fallback parameter.Text description for image generation
Image aspect ratioSupported ratios:
auto- Automatically choose the aspect ratio1:1- Square, avatars, social media3:2/2:3- Standard photos4:3/3:4- Traditional display ratio16:9/9:16- Widescreen / vertical video covers5:4/4:5- Instagram images21:9- Ultra-wide banner
Output image resolutionSupported values:
1K- ~1024px, standard resolution (the only tier Lite supports)
Number of images to generateRange: 1 to 4, default
1When n>1, the backend sends multiple concurrent requests upstream and bills by the actual number of successful images. We recommend the frontend always send 1 (to show progress image by image and make billing more intuitive).⚠️ Note: Must enter a plain number (e.g., 1), do not use quotes or it will cause an errorReference image URL list for image-to-image generationTwo formats are supported:1. Full image URL
- Publicly accessible image URL (http:// or https://)
- Example:
https://example.com/image.jpg
- Must use the full Data URI format
- Format:
data:image/{format};base64,{base64data} - Supported image formats: jpeg, png, webp
- Example:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg... - ⚠️ Note: Must include the
data:image/jpeg;base64,prefix
- Maximum 14 reference images (recommended: up to 10 object refs + 4 character refs)
- Single image size: not exceeding 10MB
- Supported formats: jpeg, png, webp
Task callback URL (base)When a task succeeds / fails, the platform calls back to
webhook + /callback (it does not forward the upstream request). Passing this parameter can significantly reduce polling; we still recommend keeping polling as a fallback.Lite usage notes
google_search/google_image_searchare not supported: Lite uses the Developer API’sinteractionsendpoint, and the upstream has not enabled the Search tool (it returns “Search as tool is not enabled for this model”), so the platform adapter does not send this parameter either. Passing it won’t raise an error and images are generated as usual, but there is no search enhancement effect at all. If you need search enhancement, switch togemini-3.1-flash-image-preview.mask_urlinpainting is not supported (the Gemini family uses aspect ratio + reference images rather than masks).- Billed by token (unlike the fixed per-image price of flash/pro): input is about 30 per million tokens, and a single 1K image ≈ 1120 output tokens ≈ $0.0336/image. The actual price is subject to the backend multiplier configuration.
- All generated images contain Google’s SynthID invisible watermark (upstream behavior, cannot be disabled).
Response
Response status code
Response data array