DEV Community

Cover image for Introducing Nano Banana Pro: Complete Developer Tutorial
Guillaume Vernade for Google AI

Posted on

Introducing Nano Banana Pro: Complete Developer Tutorial

You loved Nano-Banana? Created figurine images of all your friends and ghost face 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).

Get started with Nano Banana Pro on AI Studio

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:

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.

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.

Set up billing

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.

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
Enter fullscreen mode Exit fullscreen mode

JavaScript / TypeScript:

npm install @google/genai
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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,
        )
    )
)

# Display the image
for part in response.parts:
    if image:= part.as_image():
        image.save("cat.png")
Enter fullscreen mode Exit fullscreen mode

Siamese cat

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
        )
    )
)

# Display 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")
Enter fullscreen mode Exit fullscreen mode

Viral image

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)
Enter fullscreen mode Exit fullscreen mode

Weather in Tokyo

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
        )
    )
)
Enter fullscreen mode Exit fullscreen mode

Oak tree experiencing all seasons

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")
Enter fullscreen mode Exit fullscreen mode

General Relativity in Spanish

# 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")
Enter fullscreen mode Exit fullscreen mode

General Relativity in Japanese

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")
Enter fullscreen mode Exit fullscreen mode

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.

Guillaume Vernade career

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).

For a deeper dive into best practices, check the prompting guide in the documentation and the prompting best practices for Nano Banana publish 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.

Top comments (2)

Collapse
 
youngfra profile image
Fraser Young

Thank you

Collapse
 
jphi_baconnais profile image
Jean-Phi Baconnais

Thanks for all these tips!