Gemini-3.1-Flash-Image-preview (Nano banana2)
Gemini-3.1-Flash Image Generation
Generate images using Google Gemini 3.1 Flash model with extreme aspect ratios and Google Search enhancement
POST
Documentation Index
Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
Use this file to discover all available pages before exploring further.
- Google Gemini 3.1 Flash image generation model (Nano banana2)
- Use model parameter to select
gemini-3.1-flash-image-previewmodel - Supports text-to-image and image-to-image, up to 4K resolution output
- Up to 14 reference images to maintain style/character consistency
- Supports extreme aspect ratios (1:4, 4:1, 1:8, 8:1)
- Integrated Google Search enhancement for more accurate real-world images
- Async task management, query results by task ID
Authorizations
All endpoints require Bearer Token authenticationGet your API Key from the API Key Management PageAdd to request header:
Body
Image generation model nameExample:
"gemini-3.1-flash-image-preview"Text description for image generation
Image aspect ratioSupported ratios:
| Value | Use Case |
|---|---|
1:1 | Square, avatar, social media |
3:2 / 2:3 | Standard photo |
4:3 / 3:4 | Traditional display ratio |
16:9 / 9:16 | Widescreen / vertical video cover |
5:4 / 4:5 | Instagram images |
21:9 | Ultra-wide banner |
1:4 / 4:1 | Long poster / banner |
1:8 / 8:1 | Extreme long image / ad banner |
Number of images to generate⚠️ Note: Must be a pure number (e.g.
1), do not add quotes, otherwise it will errorList of reference image URLs for image-to-image or image editingLimit: Maximum 14 images (recommended: up to 10 object references + 4 character references)
Metadata parameters for passing additional configuration options
Response
Unique task identifier for status queries
Object type, always
generation.taskModel name used
Task status
queued- Queued for processingin_progress- Processingcompleted- Successfully completedfailed- Failed
Task progress percentage (0-100)
Task creation timestamp (Unix timestamp)
Task metadata