Skip to main content

Overview

Nano Banana 2 (codename) is Google’s latest image generation model released on February 26, 2026, with model ID gemini-3.1-flash-image-preview. It redefines image generation cost-effectiveness with Pro-level quality at Flash-tier speed and cost, making it the latest flagship of the Nano Banana series.
🔥 Released February 26, 2026: Nano Banana 2 is live! Pro-level quality, Flash-tier speed, token-based billing as low as 28% of Google’s pricing! 512px from just $0.018/image! Supports 4K output, 14 aspect ratios, Image Search Grounding, and more exclusive features.
💰 Pricing Adjustment (Effective March 1, 2026): Nano Banana 2 per-call pricing adjusted from $0.03 to $0.045/image. New token-based billing available (Input $0.07/M tokens, Output $16.8/M tokens) for flexible pay-per-resolution pricing. 512px images from just $0.018 — cheaper than per-call billing!

Core Features

Pro-Level Quality

Vibrant lighting, rich textures, sharp details - quality rivaling Nano Banana Pro at much faster speeds

4K Ultra-HD Output

Supports 512px, 1K, 2K, 4K resolutions, up to 4096×4096

14 Aspect Ratios

New additions: 1:4, 4:1, 1:8, 8:1 - total 14 aspect ratios covering more use cases

Image Search Grounding

Nano Banana 2 exclusive - pulls visual context from Google Image Search

Accurate Text Rendering

Clear, legible text in images with multilingual support - perfect for posters and marketing materials

Multi-turn Editing

Conversational image editing with iterative refinement through chat

Thinking Mode

Configurable minimal or high thinking levels for more precise complex prompt handling

Subject Consistency

Maintains resemblance across up to 5 characters and 14 reference objects

Version Comparison

FeatureNano Banana 2Nano Banana ProNano Banana
Model IDgemini-3.1-flash-image-previewgemini-3-pro-image-previewgemini-2.5-flash-image
Quality⭐⭐⭐⭐⭐ Pro-level⭐⭐⭐⭐⭐ Highest⭐⭐⭐⭐ Excellent
Speed🚀 Fastest🐢 Slower⚡ Fast
Max Resolution4K4K1K
Aspect Ratios141010
Image Search Grounding✅ Exclusive
APIYI Pricing$0.045/image (per-call)$0.05/image$0.02/image
StatusPreviewPreviewGA
Selection Guide:
  • 🔥 Best Value → Nano Banana 2 (token-based from $0.018/image, Pro-level quality + Flash-tier speed)
  • 🎨 Ultimate Quality → Nano Banana Pro ($0.05/image, highest fidelity)
  • Lowest Cost → Nano Banana ($0.025/image, fast and stable)

Pricing

Billing Mode Selection: Nano Banana 2 supports two billing modes, selected via the “Billing model” setting when creating your API token:
  • Select Pay-as-you-go or Pay-as-you-go Priority → Token-based billing
  • Select Pay-per-request or Pay-per-request Priority → Per-call billing (same as Nano Banana Pro)
  • ⚠️ Do NOT select Hybrid billing

Per-call Billing

ModelAPIYI PricingGoogle Official 4KDiscount
Nano Banana 2 gemini-3.1-flash-image-preview$0.045/image$0.151/image🔥 ~70% off
Nano Banana Pro gemini-3-pro-image-preview$0.05/image$0.151/image~67% off
Nano Banana gemini-2.5-flash-image$0.02/image$0.039/image (1K only)~50% off

Token-based Billing (Nano Banana 2 Exclusive)

Billing ItemGoogle OfficialAPIYIDiscount
Input$0.25/M tokens$0.07/M tokens28%
Output (images and text unified)Images $60/M, Text $1.5/M$16.8/M tokens28%

Token-based Billing Price Estimates

ResolutionGoogle OfficialAPIYIFal AI
512px$0.045~$0.018$0.06
1K$0.067~$0.025$0.08
2K$0.101~$0.03$0.12
4K$0.151~$0.045$0.16
💰 Token-based billing saves more! With token-based billing, 512px images from just $0.018 — only 28% of Google’s pricing! For low-resolution use cases, this is much cheaper than per-call billing ($0.045/image). For 4K, per-call and token-based pricing are similar, both far below Google’s official $0.151/image. Combined with top-up bonuses, actual costs are even lower.

Supported Resolutions & Aspect Ratios

Output Resolutions

ResolutionDescriptionRecommended Use
512pxLow resolutionThumbnails, quick previews
1KDefaultSocial media, web display
2KHigh definitionHD displays, print materials
4KUltra-high definitionProfessional design, commercial posters

Supported Aspect Ratios (14 total)

1:1, 1:4, 4:1, 1:8, 8:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
Compared to Nano Banana Pro’s 10 aspect ratios, Nano Banana 2 adds 1:4, 4:1, 1:8, 8:1 - ultra-tall/ultra-wide ratios ideal for long-form images and infographics.

Calling Method

Google Native Format

  • Endpoint: /v1beta/models/gemini-3.1-flash-image-preview:generateContent
  • ✅ Custom resolutions (512px/1K/2K/4K)
  • ✅ 14 aspect ratios
  • 📖 Google official API format

Quick Start

Endpoint

POST https://api.apiyi.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent

Basic Generation Example

import requests
import base64

API_KEY = "sk-your-api-key"
PROMPT = "A cute Shiba Inu sitting under cherry blossom trees, watercolor style, HD details"

response = requests.post(
    "https://api.apiyi.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={
        "contents": [{"parts": [{"text": PROMPT}]}],
        "generationConfig": {
            "responseModalities": ["IMAGE"],
            "imageConfig": {"aspectRatio": "16:9", "imageSize": "2K"}
        }
    },
    timeout=300
).json()

img_data = response["candidates"][0]["content"]["parts"][0]["inlineData"]["data"]
with open("output.png", 'wb') as f:
    f.write(base64.b64decode(img_data))
print("Image saved to output.png")

Image Editing Example

Nano Banana 2 supports multi-turn conversational image editing:
import requests
import base64

API_KEY = "sk-your-api-key"

# Read the image to edit
with open("input.jpg", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://api.apiyi.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={
        "contents": [{
            "parts": [
                {"text": "Please blur the background to highlight the person in the foreground"},
                {"inlineData": {"mimeType": "image/jpeg", "data": image_b64}}
            ]
        }],
        "generationConfig": {
            "responseModalities": ["IMAGE"],
            "imageConfig": {"aspectRatio": "16:9", "imageSize": "2K"}
        }
    },
    timeout=300
).json()

img_data = response["candidates"][0]["content"]["parts"][0]["inlineData"]["data"]
with open("edited.png", 'wb') as f:
    f.write(base64.b64decode(img_data))

Request Parameters

Parameter Reference

ParameterTypeRequiredDescription
contentsarrayYesContent array containing text and/or inlineData
generationConfig.responseModalitiesarrayYesResponse type: ["IMAGE"] or ["TEXT", "IMAGE"]
generationConfig.imageConfig.aspectRatiostringNoAspect ratio, default 1:1
generationConfig.imageConfig.imageSizestringNoResolution: 512px / 1K / 2K / 4K, default 1K

Response Format

Response Example

{
  "candidates": [{
    "content": {
      "parts": [{
        "inlineData": {
          "mimeType": "image/png",
          "data": "iVBORw0KGgoAAAANSUhEUg..."
        }
      }]
    },
    "finishReason": "STOP"
  }],
  "usageMetadata": {
    "promptTokenCount": 10,
    "candidatesTokenCount": 258
  }
}

FAQ

Nano Banana 2 (gemini-3.1-flash-image-preview) is based on Gemini 3.1 Flash, while Nano Banana Pro (gemini-3-pro-image-preview) is based on Gemini 3 Pro. Key differences:
  • Speed: Nano Banana 2 is faster (Flash-tier speed)
  • Price: Nano Banana 2 token-based billing is cheaper (from $0.018 vs $0.05)
  • Aspect Ratios: Nano Banana 2 supports 14 (4 more)
  • Image Search Grounding: Nano Banana 2 exclusive
  • ⚠️ Ultimate Quality: Nano Banana Pro still slightly better
Recommended! Nano Banana 2 offers near-Pro-level quality at a lower price with faster speed. Unless you have extreme quality requirements, Nano Banana 2 is the better choice.Simply change the model name from gemini-3-pro-image-preview to gemini-3.1-flash-image-preview.
Image Search Grounding is a Nano Banana 2 exclusive feature. It pulls visual context from Google Image Search to generate images that better match real-world subjects. For example, when generating images of real landmarks, it can reference search results for improved accuracy.
Thinking Mode allows the model to reason and analyze before generating images, improving accuracy for complex prompts. Setting it to high produces the best results but slightly increases generation time. Best for tasks requiring precise composition, text rendering, or complex scenes.
Generation time depends on resolution and thinking mode:
  • 1K resolution: ~5-10 seconds
  • 2K resolution: ~10-15 seconds
  • 4K resolution: ~15-25 seconds
  • Enabling high thinking mode adds a few extra seconds
Recommend setting a longer timeout (at least 120 seconds) for occasional delays.
Supports image/png and image/jpeg formats. Can be uploaded via base64 encoding or Files API.
All output images carry SynthID invisible digital watermarks (Google’s AI-generated content identification technology) - invisible to the naked eye and doesn’t affect usage.
Nano Banana 2 is currently in Preview status. Features and pricing may be adjusted. Please follow documentation updates for the latest information.