Gemini-3.1-Flash-Image-preview (Nano banana2)
Gemini-3.1-Flash-Image-preview (Nano banana2) Image Generation
- Supports text-to-image and image-to-image, up to 4K resolution output
- Up to 14 reference images for style/character consistency
- Supports extreme aspect ratios (1:4, 4:1, 1:8, 8:1)
- Integrated Google Search enhancement for more realistic image generation
POST
Documentation Index
Fetch the complete documentation index at: https://gccai.heqingsong.uk/llms.txt
Use this file to discover all available pages before exploring further.
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 nameSupported models:
gemini-3.1-flash-image-preview- Standard versiongemini-3.1-flash-image-preview-official- Official version
"gemini-3.1-flash-image-preview" or "gemini-3.1-flash-image-preview-official"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 banner1:4/4:1- Long poster / banner1:8/8:1- Extreme long images / banner ads
Output image resolutionSupported values:
0.5K- ~512px, low-resolution preview1K- ~1024px, standard resolution (default)2K- ~2048px, high resolution4K- ~4096px, ultra-high resolution
Note: Different resolutions have different pricing. 4K costs more than 1K.
Number of images to generateRange: 1-4 (minimum 1, maximum 4)Default: 1⚠️ Note: Must enter a plain number (e.g.,
1), do not use quotes or it will cause an errorWhether to use the official channel fallback
false: Do not use (default)true: Use official channel
Reference 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
Enable Google text search enhancement
true: The model will search web text information to assist image generation, suitable for scenarios requiring real-world informationfalse: Disabled (default)
Enable Google image search enhancement
true: In addition to text search, will also search for reference images to assist generation, suitable for scenarios requiring visual referencesfalse: Disabled (default)
Note: Must be used together with google_search: true
Response
Response status code
Response data array