topimageprompttopimageprompt
Explore

BROWSE BY

  • By AI EngineMidjourney, DALL-E, Stable Diffusion
  • By MoodDark, Dreamy, Epic, Minimal, Warm
  • By Aspect RatioSquare 1:1 · Portrait 9:16 · Wide 16:9

LIBRARY SIZE

  • 600 PromptsTotal in library
  • 12 CategoriesAcross all styles
  • Updated DailyNew prompts every day
Collections

Curated Collections

View all
World Cup 2026 AI PromptsWorld Cup 2026 AI PromptsWorld Cup 2026 AI PromptsWorld Cup 2026 AI Prompts
World Cup 2026 AI Prompts
57 Prompts
Trending

Trending Now

Updated hourly
CEO Headshot Upgrade
CEO Headshot Upgrade
GPT Image 2 · 3 copies
#1
Japanese Ama Freediver Surfacing Ocean Dawn
Japanese Ama Freediver Surfacing Ocean Dawn
GPT Image 2 · 3 copies
#2
Wildfire Smoke Sunset Portrait
Wildfire Smoke Sunset Portrait
GPT Image 2 · 2 copies
#3
Blizzard Portrait: Into the White
Blizzard Portrait: Into the White
GPT Image 2 · 2 copies
#4
Legend 30th Anniversary Reissue Cover
Legend 30th Anniversary Reissue Cover
GPT Image 2 · 2 copies
#5
This week's most copied prompt
Blog

Latest Articles

View all
How to Get Canva Pro for FREE in 2026: The Complete Student & Creator Guide (Magic Studio AI)
How to Get Canva Pro for FREE in 2026: The Complete Student & Creator Guide (Magic Studio AI)
AI Tools & Design · Aug 13, 2026
How to Get GPT-5.6 (Sol & Luna) and Frontier 2026 AI Models for FREE: 5 Legit Working Methods
How to Get GPT-5.6 (Sol & Luna) and Frontier 2026 AI Models for FREE: 5 Legit Working Methods
AI Tools & Tutorials · Aug 13, 2026
How to Get GitHub Copilot for FREE (100% Legal): The Step-by-Step Student Developer Pack Guide (2026)
How to Get GitHub Copilot for FREE (100% Legal): The Step-by-Step Student Developer Pack Guide (2026)
AI Tools & Developer Guides · Aug 12, 2026
Get weekly prompt tipsRead the Blog
Sign in
topimageprompttopimageprompt
Sign in
ExploreCollectionsTrendingBlog
topimageprompttopimageprompt
ExploreCollectionsTrendingBlog
Sign in
Loading page content
topimageprompttopimageprompt

The world's cleanest AI prompt library. Browse, discover, and copy prompts for your favorite image generator.

Explore

  • All Prompts
  • Models & Styles
  • Trending
  • New Arrivals
  • Collections
  • Blog
  • Site Map

Categories

  • Photorealism
  • Cyberpunk
  • 3D Render
  • Anime
  • Dark Fantasy
  • All Categories

Stay Updated

Get weekly prompt drops and style guides in your inbox.

No spam. Just new prompt alerts.

© 2026 topimageprompt. All rights reserved.
About
Editorial Policy
Privacy Policy
Terms of Use
Contact
Site Map
Loading page content
Home/Blog/Masterclass/How to Use Google's Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) API: Code, Pricing, & Troubleshooting (2026)
MasterclassUpdated Jul 15, 2026

How to Use Google's Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) API: Code, Pricing, & Troubleshooting (2026)

Learn how to integrate Google's Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) API. Get SDK code, pricing, and fixes for the 400 error.

T
topimageprompt Team5 min read · Last reviewed Jul 15, 2026
On this page
1. What is Nano Banana 2 Lite?Key Features2. Is Nano Banana 2 Lite on Hugging Face?3. API Pricing Structure4. API Integration Code (Python SDK)Step 1: Install or Upgrade the SDKStep 2: Set Your API KeyStep 3: Python Implementation Script5. Troubleshooting: How to Fix the 400 ErrorWhy it happens:The Fix:Frequently asked questionsSources and further reading
On this page 13 sections
1. What is Nano Banana 2 Lite?Key Features2. Is Nano Banana 2 Lite on Hugging Face?3. API Pricing Structure4. API Integration Code (Python SDK)Step 1: Install or Upgrade the SDKStep 2: Set Your API KeyStep 3: Python Implementation Script5. Troubleshooting: How to Fix the 400 ErrorWhy it happens:The Fix:Frequently asked questionsSources and further reading
A sleek dark neon developer dashboard showing a Python script calling the gemini-3.1-flash-lite-image model, with the Google DeepMind logo in the background
✓

Key takeaways

Google's Nano Banana 2 Lite (model ID: gemini-3.1-flash-lite-image) is a proprietary, API-only image model. It generates 1K images in 4 seconds at $0.034 per 1,000 generations. It is not open-source and cannot be run locally via Hugging Face. To fix the common 400 HTTP error, run pip install --upgrade google-genai to update your local SDK registry.

Google has officially released Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image). This complete developer guide covers the Python SDK integration code, the pricing structure, and how to fix the common

On June 30, 2026, Google DeepMind officially released Gemini 3.1 Flash-Lite Image, codenamed Nano Banana 2 Lite.

This model is a significant release for developers building high-volume image pipelines. While premium models like Midjourney v8.1 focus on creative visual styling and FLUX.2 dominates high-fidelity photorealism, Nano Banana 2 Lite is built for speed and low cost, generating a standard 1K resolution image in approximately 4 seconds.

However, because the model is new, developers are encountering common integration errors — most notably the HTTP 400 error: Unsupported Model.

This developer guide covers the pricing structure, Python SDK integration code, and step-by-step troubleshooting to get the Nano Banana 2 Lite API working in your application.


1. What is Nano Banana 2 Lite?

Nano Banana 2 Lite is the entry-tier image generation model in Google's 3.1 image generation suite. It is designed to sit alongside the generalist workhorse model Nano Banana 2 (gemini-3.1-flash-image) and the premium model Nano Banana Pro (gemini-3-pro-image).

For a complete performance comparison of how Google's image models stack up against the competition, review our GPT Image 2 vs Midjourney vs FLUX vs Krea 2 Comparison.

Key Features

  • Ultra-Low Latency: Renders 1024x1024px images in 4 seconds.
  • SynthID Watermarking: Automatically embeds Google's invisible, crop-resistant digital watermarks into every image.
  • Aspect Ratio Support: Natively supports 14 distinct aspect ratios (including 1:1, 16:9, 9:16, 4:3, 3:2, and 2:3).
  • Multimodal Input: A 65,536-token context window allows you to feed both text descriptions and reference images directly to the API for style transfer and editing.

2. Is Nano Banana 2 Lite on Hugging Face?

Many developers are searching GitHub and Hugging Face looking for weights to run Nano Banana 2 Lite locally on consumer GPUs.

The Answer: No. Nano Banana 2 Lite is a proprietary, closed-source API-only model hosted on Google’s infrastructure. It is accessed exclusively via the Google GenAI API or cloud gateways (such as Fal.ai or OpenRouter). You cannot run it locally.

For developers seeking open-weight models that can be run locally, we recommend checking out FLUX.2 Dev or Stable Diffusion. See our Stable Diffusion Anime Checkpoints Guide for details on configuring local open-source setups.


3. API Pricing Structure

Google has priced Nano Banana 2 Lite for developers running high-volume pipelines (e.g. real-time user image generators in chat apps).

  • Priced per image: Approximately $0.034 per 1,000 images generated at standard quality.
  • Token-based billing: Alternately billed at $0.25 per million input tokens and $1.50 per million output tokens.

This is approximately 5–10× cheaper than running standard API pipelines for Midjourney or FLUX.2 Pro, making it the most cost-efficient image API available in 2026.


4. API Integration Code (Python SDK)

To interact with the Nano Banana 2 Lite API, you must use the official google-genai SDK.

Step 1: Install or Upgrade the SDK

BASH
pip install --upgrade google-genai

Step 2: Set Your API Key

Set your Gemini API key in your environment variables:

BASH
export GEMINI_API_KEY="your-api-key-here"

Step 3: Python Implementation Script

PYTHON
from google import genai
from google.genai import types

def generate_nano_banana_image(prompt_text: str, aspect_ratio: str = "16:9"):
    # Initialize the client (automatically reads GEMINI_API_KEY from environment)
    client = genai.Client()
    
    print(f"Sending prompt to Nano Banana 2 Lite: '{prompt_text}'...")
    
    try:
        response = client.models.generate_images(
            model='gemini-3.1-flash-lite-image',
            prompt=prompt_text,
            config=types.GenerateImagesConfig(
                number_of_images=1,
                aspect_ratio=aspect_ratio,
                output_mime_type="image/jpeg",
                person_generation="ALLOW_ADULT" # Options: DONT_ALLOW, ALLOW_ADULT
            )
        )
        
        # Save the generated image
        for i, generated_image in enumerate(response.generated_images):
            output_file = f"output_nano_banana_{i}.jpg"
            with open(output_file, "wb") as f:
                f.write(generated_image.image.image_bytes)
            print(f"Successfully generated and saved: {output_file}")
            
    except Exception as e:
        print(f"API Generation Failed: {e}")

# Example invocation
generate_nano_banana_image(
    prompt_text="A sleek cyberpunk office desk at night, neon reflections on a clean glass tabletop, glowing keyboard, cinematic side-lighting --ar 16:9"
)

5. Troubleshooting: How to Fix the 400 Error

The most common issue developers are reporting is the following exception:

TEXT
google.genai.errors.APIError: [400] Unsupported Model: gemini-3.1-flash-lite-image

Why it happens:

Your local google-genai SDK library uses a local registry file of supported models. If your library was installed before the June 30, 2026 release date, the SDK will block your code from executing the request because it doesn't recognize the new model ID gemini-3.1-flash-lite-image.

The Fix:

You must force the SDK to update its model registry by upgrading to the latest version:

BASH
# Upgrade the core SDK
pip install --upgrade google-genai

# If you are using Node.js, upgrade the npm package:
npm install @google/genai@latest

If you are using a managed container (like Docker), ensure you trigger a rebuild with --no-cache to force the package manager to fetch the July 1, 2026 release of the library.


Ready to find the best prompts to feed into your new Nano Banana 2 Lite API? Browse our Explore Prompt Library to copy verified styles and layouts.

Quick answers

Frequently asked questions

What is Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image)?+
Nano Banana 2 Lite (API ID: gemini-3.1-flash-lite-image) is a low-latency, cost-effective image generation model released by Google DeepMind on June 30, 2026. It is designed to generate standard 1K resolution images in approximately 4 seconds at a cost of $0.034 per 1,000 generations, making it optimized for high-volume developer applications.
How do I fix the 400 Unsupported Model error for gemini-3.1-flash-lite-image?+
The HTTP 400 error occurs because your local google-genai library version was installed before the model's release and does not contain the new model ID in its registry. To resolve this, run "pip install --upgrade google-genai" (Python) or "npm install @google/genai@latest" (Node.js) to pull the updated SDK.
Can I run Nano Banana 2 Lite locally via Hugging Face?+
No, Nano Banana 2 Lite is a proprietary, closed-source model hosted by Google. There are no model weights available on Hugging Face or GitHub, and it cannot be run locally. It is accessed exclusively as an API service via the Google GenAI SDK.
Research

Sources and further reading

  1. Google DeepMind: Gemini 3.1 Flash-Lite Image (Nano Banana 2 Lite) Model Release and Pricing Documentation (June 30, 2026)
  2. Google GenAI SDK GitHub Repository: Release Tags and Model Registry Updates (June 2026)
Share
Continue creating

Try these related prompts

Explore all prompts →
CEO Headshot Upgrade example
GPT Image 2

CEO Headshot Upgrade

Photorealistic AI image prompt

View prompt →
Japanese Ama Freediver Surfacing Ocean Dawn example
GPT Image 2

Japanese Ama Freediver Surfacing Ocean Dawn

Photorealistic AI image prompt

View prompt →
Restore and Colorize Old Photo example
GPT Image 2

Restore and Colorize Old Photo

Transformation AI image prompt

View prompt →
Legend 30th Anniversary Reissue Cover example
GPT Image 2

Legend 30th Anniversary Reissue Cover

Album Art AI image prompt

View prompt →
Double Exposure Album Portrait example
GPT Image 2

Double Exposure Album Portrait

Album Art AI image prompt

View prompt →
Forest Double Exposure example
GPT Image 2

Forest Double Exposure

Digital Art AI image prompt

View prompt →
Get the next practical AI guideOne useful workflow each week. No noise.
More from the blog

Keep learning

View all articles →
Best Stable Diffusion Anime Checkpoints 2026: Illustrious XL, Pony & LoRA Guide
Masterclass·Aug 10, 2026

Best Stable Diffusion Anime Checkpoints 2026: Illustrious XL, Pony & LoRA Guide

Discover the best stable diffusion anime checkpoints in 2026. Compare Illustrious XL vs Pony V6 XL vs NoobAI XL, learn correct LoRA weights, CLIP Skip settings,

Read article →
GPT Image 2 Thinking Mode: The Hidden Web Grounding Trick for Infographics
Masterclass·Aug 7, 2026

GPT Image 2 Thinking Mode: The Hidden Web Grounding Trick for Infographics

Learn the hidden GPT Image 2 thinking mode trick that uses web grounding to generate accurate AI infographics and data visualizations every time.

Read article →
GPT Image 2 Prompt Guide 2026: Frameworks, 18 Copyable Examples & What Changed From DALL-E 3
Masterclass·Aug 7, 2026

GPT Image 2 Prompt Guide 2026: Frameworks, 18 Copyable Examples & What Changed From DALL-E 3

Master GPT Image 2 prompting in 2026. Learn the CRAFT framework, 18 copyable prompt examples, text rendering syntax, and editing techniques that replaced DALL-E

Read article →