Karla
Wed, 26 Nov 2025 10:54:05 +0000
AI & Data Sci.

Guillaume Vernade for Google AI

Posted on Nov 21

Introducing Nano Banana Pro: Complete Developer Tutorial

Building with Gemini 3 (Google AI) (6 Part Series)

You loved Nano-Banana? Created figurine images of all your friends and ghost faces behind all your foes? Here now comes the not-so-nano “Gemini 3 Pro Image” model, that you will all prefer calling Nano Banana Pro!

While the Flash model (Nano Banana) brought speed and affordability, the Pro version introduces “thinking” capabilities, search grounding, and high-fidelity 4K output. It’s time to go bananas with complex creative tasks!

This guide will walk you through the advanced features of Nano Banana Pro using the Gemini Developer API.

This guide will cover:

1. Using Nano Banana Pro in Google AI Studio

2. Project setup

3. Initialize the Client

4. Basic Generation (The Classics)

5. The “Thinking” Process

6. Search Grounding

7. High-Resolution 4K Generation

8. Multilingual Capabilities

9. Advanced Image Mixing

10. Pro-Exclusive Demos

Note: for an interactive version of this post, checkout the python cookbook or the AI Studio’s Javascript Notebook.

1) Using Nano Banana Pro in Google AI Studio

While end-users can access Nano Banana Pro in the Gemini app, the best environment for developers to prototype and test prompts is Google AI Studio. AI Studio is a playground to experiment with all available AI models before writing any code, and it’s also the entry point for building with the Gemini API.

You can use Nano Banana Pro within AI Studio. To get started, go to aistudio.google.com, sign in with your Google account, and select Nano Banana Pro (Gemini 3 Pro Image) from the model picker.

Contrary to Nano-Banana, the pro version doesn’t have a free tier, which means you need to select an API key with billing enabled (see “project setup” section below).

Tip: You can also vibe code Nano Banana web apps directly in AI Studio at ai.studio/apps, or explore the code and remix one of the existing apps.

2) Project setup

To follow this guide, you will need the following:

An API key from Google AI Studio.

Billing set up for your project.

The Google Gen AI SDK for Python or JavaScript/TypeScript.

If you already are a hardcore Gemini API user with all of that, great! just skip this section and move to the next one. Otherwise, here’s how to get started:

Step A: Get your API Key

When you first log in on AI Studio, a Google Cloud project and an API key should be automatically created.

Open the API key management screen and click on the “copy” icon to copy your API key.

Step B: Enable Billing

Since Nano Banana Pro doesn’t have a free tier. You must enable billing on your Google Cloud project.

In the API key management screen, click Set up billing next to your project and follow the on-screen instructions.

How much does Nano Banana Pro cost?

Image generation with Nano Banana Pro is more expensive than the Flash version, especially for 4K images. At the time this post is published, a 1K or 2K image costs $0.134, while a 4K one costs $0.24 (plus the token cost of the input and the text output).

Check the pricing in the documentation for the latest details.

Pro tip: To save 50% on your generation costs, you can use the Batch API. In exchange you might have to wait up to 24h before getting your images.

Step C: Install the SDK

Choose the SDK for your preferred language.

Python:

pip install -U google-genai
# Install the Pillow library for image manipulation
pip install Pillow

JavaScript / TypeScript:

npm install @google/genai

Note: The following examples use the Python SDK for demonstration. Equivalent code snippets to use Nano Banana in JavaScript are provided in this JS Notebook.

3) Initialize the Client

To use the Pro model, you’ll need to use the gemini-3-pro-image-preview model ID.

from google import genai
from google.genai import types

# Initialize the client
client = genai.Client(api_key="YOUR_API_KEY")

# Set the model ID
PRO_MODEL_ID = "gemini-3-pro-image-preview"

4) Basic Generation (The Classics)

Before we get into the fancy stuff, let’s look at a standard generation. You can control the output using response_modalities (to get text and images or only images) and aspect_ratio.

prompt = "Create a photorealistic image of a siamese cat with a green left eye and a blue right one"
aspect_ratio = "16:9" # "1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9" or "21:9"

response = client.models.generate_content(
    model=PRO_MODEL_ID,
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['Text', 'Image'], # Or just ['Image']
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
        )
    )
)

# Save the image
for part in response.parts:
    if image:= part.as_image():
        image.save("cat.png")

Chat mode is also an option (it’s actually what I would recommend for multi-turn editing). Check the 8th example, “Polyglot Banana”, for an example.

5) The “Thinking” Process (It’s alive!)

Nano Banana Pro isn’t just drawing; it’s thinking. This means it can reason through your most complex, twisted prompts before generating an image. And the best part? You can peek into its brain!

To enable this, set include_thoughts=True in the thinking_config.

prompt = "Create an unusual but realistic image that might go viral"
aspect_ratio = "16:9"

response = client.models.generate_content(
    model=PRO_MODEL_ID,
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['Text', 'Image'],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
        ),
        thinking_config=types.ThinkingConfig(
            include_thoughts=True # Enable thoughts
        )
    )
)

# Save the image and thoughts
for part in response.parts:
  if part.thought:
    print(f"Thought: {part.text}")
  elif image:= part.as_image():
    image.save("viral.png")

And you should get something like:

## Imagining Llama Commuters

I'm focusing on the llamas now. The goal is to capture them as
daily commuters on a bustling bus in La Paz, Bolivia. My plan
involves a vintage bus crammed with amused passengers. The image
will highlight details like one llama looking out the window,
another interacting with a passenger, all while people take
photos.

[IMAGE]

## Visualizing the Concept

I'm now fully immersed in the requested scenario. My primary
focus is on the "unusual yet realistic" aspects. The scene is
starting to take shape with the key elements established.

This transparency helps you understand how the model interpreted your request. It’s like having a conversation with your artist!

6) Search Grounding (Real-time magic)

One of the most game-changing features is Search Grounding. Nano Banana Pro isn’t stuck in the past; it can access real-time data from Google Search to generate accurate, up-to-date images. Want the weather? You got it.

For example, you can ask it to visualize the current weather forecast:

prompt = "Visualize the current weather forecast for the next 5 days in Tokyo as a clean, modern weather chart. add a visual on what i should wear each day"

response = client.models.generate_content(
    model=PRO_MODEL_ID,
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['Text', 'Image'],
        image_config=types.ImageConfig(
            aspect_ratio="16:9",
        ),
        tools=[{"google_search": {}}] # Enable Google Search
    )
)

# Save the image
for part in response.parts:
    if image:= part.as_image():
        image.save("weather.png")

# Display sources (you must always do that)
print(response.candidates[0].grounding_metadata.search_entry_point.rendered_content)

7) Go Big or Go Home: 4K Generation

Need print-quality images? Nano Banana Pro supports 4K resolution. Because sometimes, bigger is better.

prompt = "A photo of an oak tree experiencing every season"
resolution = "4K" # Options: "1K", "2K", "4K", be careful lower case do not work.

response = client.models.generate_content(
    model=PRO_MODEL_ID,
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['Text', 'Image'],
        image_config=types.ImageConfig(
            aspect_ratio="1:1",
            image_size=resolution
        )
    )
)

Note: 4K generation comes at a higher cost, so use it wisely!

8) Polyglot Banana (Multilingual Capabilities)

The model can generate and even translate text within images across over a dozen languages. It’s basically a universal translator for your eyes.

# Generate an infographic in Spanish
message = "Make an infographic explaining Einstein's theory of General Relativity suitable for a 6th grader in Spanish"

response = chat.send_message(message,
    config=types.GenerateContentConfig(
        image_config=types.ImageConfig(aspect_ratio="16:9")
    )
)

# Save the image
for part in response.parts:
    if image:= part.as_image():
        image.save("relativity.png")

# Translate it to Japanese
message = "Translate this infographic in Japanese, keeping everything else the same"
response = chat.send_message(message)

# Save the image
for part in response.parts:
    if image:= part.as_image():
        image.save("relativity_JP.png")

9) Mix it up! (Advanced Image Mixing)

While the Flash model can mix up to 3 images, the Pro model can handle up to 14 images! That’s a whole party in one prompt. Perfect for creating complex collages or showing off your entire product line.

# Mix multiple images
response = client.models.generate_content(
    model=PRO_MODEL_ID,
    contents=[
        "An office group photo of these people, they are making funny faces.",
        PIL.Image.open('John.png'),
        PIL.Image.open('Jane.png'),
        # ... add up to 14 images
    ],
)

# Save the image
for part in response.parts:
    if image:= part.as_image():
        image.save("group_picture.png")

Note: If you want very high fidelity for your characters, limit yourself to 5, which is already more than enough for a party night!

10) Show off time! (Pro-Exclusive Demos)

Here are some examples of what’s possible only with Nano Banana Pro. Prepare to be amazed:

Personalized Pixel Art (Search Grounding)

Prompt: “Search the web then generate an image of isometric perspective, detailed pixel art that shows the career of Guillaume Vernade”

This uses search grounding to find specific information about a person and visualizes it in a specific style.

Complex Text Integration

Prompt: “Show me an infographic about how sonnets work, using a sonnet about bananas written in it, along with a lengthy literary analysis of the poem. Good vintage aesthetics”

The model can generate coherent, lengthy text and integrate it perfectly into a complex layout.

High-Fidelity Mockups

Prompt: “A photo of a program for the Broadway show about TCG players on a nice theater seat, it’s professional and well made, glossy, we can see the cover and a page showing a photo of the stage.”

Create photorealistic mockups of print materials with accurate lighting and texture.

11) Best Practices and prompting tips for Nano Banana and Nano Banana Pro

To achieve the best results with the Nano Banana models, follow these prompting guidelines:

Be Hyper-Specific: The more detail you provide about subjects, colors, lighting, and composition, the more control you have over the output.
Provide Context and Intent: Explain the purpose or desired mood of the image. The model’s understanding of context will influence its creative choices.
Iterate and Refine: Don’t expect perfection on the first try. Use the model’s conversational ability to make incremental changes and refine your image.
Use Step-by-Step Instructions: For complex scenes, break your prompt into a series of clear, sequential instructions.
Use Positive Framing: Instead of negative prompts like “no cars,” describe the desired scene positively: “an empty, deserted street with no signs of traffic.”
Control the Camera: Use photographic and cinematic terms to direct the composition, such as “wide-angle shot”, “macro shot”, or “low-angle perspective”.
Use search grounding to your advantage: When you know that you want the model to use real-time or real-world data, be very precise about it. “Search the web about the last Olympic Lyonnais’s game and make an infographics” will work better than just “an infographics of the OL last games” (which should still work, but don’t take chances).
Use the Batch API to lower your costs and get more quota: The batch API is a way to send small or very large batches of requests together. They might take up to 24 to be processed, but in exchange you can save 50% on your generation costs. And the quota is also higher!

For a deeper dive into best practices, check the prompting guide in the documentation and the prompting best practices for Nano Banana published on the official blog.

Wrap up

Nano Banana Pro (Gemini 3 Pro Image) opens up a new frontier for AI image generation. With its ability to think, search, and render in 4K, it’s a tool for serious creators (and serious fun).

Ready to try it out? Head over to Google AI Studio, try or customize our Apps or check out the cookbook.