Complete Developer Tutorial for Nano Banana Pro

@GoogleAIStudio
ENGLISH8 months ago · Nov 22, 2025
728K
3.6K
588
58
5.0K

TL;DR

A comprehensive guide for developers to leverage Nano Banana Pro (Gemini 3 Pro Image), featuring tutorials on search grounding, 4K resolution, and advanced image mixing via the Gemini API.

Discover how this next-generation AI model's advanced features—including thinking, search grounding, and stunning 4K output—will empower you to build complex and creative applications.

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

  1. Project setup
  2. Initialize the Client
  3. Basic Generation (The Classics)
  4. The "Thinking" Process
  5. Search Grounding
  6. High-Resolution 4K Generation
  7. Multilingual Capabilities
  8. Advanced Image Mixing
  9. Pro-Exclusive Demos
  10. Best Practices and prompting tips

Note



: for an interactive version of this post, check out 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).

Google AI Studio - inline image

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.

Google AI Studio - inline image

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.

Google AI Studio - inline image

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:

text
1pip install -U google-genai
2# Install the Pillow library for image manipulation
3pip install Pillow

JavaScript / TypeScript:

text
1npm 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.

python
1from google import genai
2from google.genai import types
3
4# Initialize the client
5client = genai.Client(api_key="YOUR_API_KEY")
6
7# Set the model ID
8PRO_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.

python
1prompt = "Create a photorealistic image of a siamese cat with a green left eye and a blue right one"
2aspect_ratio = "16:9" # "1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9" or "21:9"
3
4response = client.models.generate_content(
5 model=PRO_MODEL_ID,
6 contents=prompt,
7 config=types.GenerateContentConfig(
8 response_modalities=['Text', 'Image'], # Or just ['Image']
9 image_config=types.ImageConfig(
10 aspect_ratio=aspect_ratio,
11 )
12 )
13)
14
15# Display the image
16for part in response.parts:
17 if image:= part.as_image():
18 image.save("cat.png")
Google AI Studio - inline image

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

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.

python
1prompt = "Create an unusual but realistic image that might go viral"
2aspect_ratio = "16:9"
3
4response = client.models.generate_content(
5 model=PRO_MODEL_ID,
6 contents=prompt,
7 config=types.GenerateContentConfig(
8 response_modalities=['Text', 'Image'],
9 image_config=types.ImageConfig(
10 aspect_ratio=aspect_ratio,
11 ),
12 thinking_config=types.ThinkingConfig(
13 include_thoughts=True # Enable thoughts
14 )
15 )
16)
17
18# Display the image and thoughts
19for part in response.parts:
20 if part.thought:
21 print(f"Thought: {part.text}")
22 elif image:= part.as_image():
23 image.save("viral.png")

And you should get something like:

text
1## Imagining Llama Commuters
2
3I'm focusing on the llamas now. The goal is to capture them as
4daily commuters on a bustling bus in La Paz, Bolivia. My plan
5involves a vintage bus crammed with amused passengers. The image
6will highlight details like one llama looking out the window,
7another interacting with a passenger, all while people take
8photos.
9
10[IMAGE]
11
12## Visualizing the Concept
13
14I'm now fully immersed in the requested scenario. My primary
15focus is on the "unusual yet realistic" aspects. The scene is
16starting to take shape with the key elements established.
Google AI Studio - inline 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:

python
1prompt = "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"
2
3response = client.models.generate_content(
4 model=PRO_MODEL_ID,
5 contents=prompt,
6 config=types.GenerateContentConfig(
7 response_modalities=['Text', 'Image'],
8 image_config=types.ImageConfig(
9 aspect_ratio="16:9",
10 ),
11 tools=[{"google_search": {}}] # Enable Google Search
12 )
13)
14
15# Save the image
16for part in response.parts:
17 if image:= part.as_image():
18 image.save("weather.png")
19
20# Display sources (you must always do that)
21print(response.candidates[0].grounding_metadata.search_entry_point.rendered_content)
Google AI Studio - inline image

7. Go Big or Go Home: 4K Generation

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

python
1prompt = "A photo of an oak tree experiencing every season"
2resolution = "4K" # Options: "1K", "2K", "4K", be careful lower case do not work.
3
4response = client.models.generate_content(
5 model=PRO_MODEL_ID,
6 contents=prompt,
7 config=types.GenerateContentConfig(
8 response_modalities=['Text', 'Image'],
9 image_config=types.ImageConfig(
10 aspect_ratio="1:1",
11 image_size=resolution
12 )
13 )
14)
Google AI Studio - inline image

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.

python
1# Generate an infographic in Spanish
2message = "Make an infographic explaining Einstein's theory of General Relativity suitable for a 6th grader in Spanish"
3
4response = chat.send_message(message,
5 config=types.GenerateContentConfig(
6 image_config=types.ImageConfig(aspect_ratio="16:9")
7 )
8)
9
10# Save the image
11for part in response.parts:
12 if image:= part.as_image():
13 image.save("relativity.png")
Google AI Studio - inline image
python
1# Translate it to Japanese
2message = "Translate this infographic in Japanese, keeping everything else the same"
3response = chat.send_message(message)
4
5# Save the image
6for part in response.parts:
7 if image:= part.as_image():
8 image.save("relativity_JP.png")
Google AI Studio - inline image

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.

python
1# Mix multiple images
2response = client.models.generate_content(
3 model=PRO_MODEL_ID,
4 contents=[
5 "An office group photo of these people, they are making funny faces.",
6 PIL.Image.open('John.png'),
7 PIL.Image.open('Jane.png'),
8 # ... add up to 14 images
9 ],
10)
11
12# Save the image
13for part in response.parts:
14 if image:= part.as_image():
15 image.save("group_picture.png")
Google AI Studio - inline image

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.

Google AI Studio - inline image

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.

Google AI Studio - inline image

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.

Google AI Studio - inline image

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.

One-click save

Use YouMind for AI deep reading of viral articles

Save the source, ask focused questions, summarize the argument, and turn a viral article into reusable notes in one AI workspace.

Explore YouMind
For creators

Turn your Markdown into a clean 𝕏 article

When you publish your own long-form writing, images, tables, and code blocks make 𝕏 formatting painful. YouMind turns a full Markdown draft into a clean, ready-to-post 𝕏 article.

Try Markdown to 𝕏

More patterns to decode

Recent viral articles

Explore more viral articles