Nano Banana is Google’s native image generation model built into the Gemini family. It produces high quality images from text prompts and supports editing, inpainting, and multi-modal inputs through a straightforward REST API. Whether you are building a SaaS product, automating creative assets, or prototyping visual content, the Nano Banana API gives you programmatic control over image generation without needing a local GPU.
What Is Nano Banana and How Does It Fit Into the AI Image Generation Landscape
Nano Banana is the image generation capability inside Google’s Gemini models. The model family includes Nano Banana 2 (based on Gemini 3.1 Flash) for fast, high volume generation, and Nano Banana Pro (based on Gemini 3 Pro) for higher fidelity professional output. Both models accept text prompts and optional reference images, then return generated images through the same API surface.
Compared to other text-to-image models like FLUX, DALL-E 3, or Midjourney, Nano Banana stands out in a few areas. It handles photorealism well, especially for faces and natural scenes. Its editing capabilities let you modify specific regions of an image using inpainting masks. And because it runs on Google’s infrastructure, latency is generally low even at scale.
Getting Your API Key
Before making any requests, you need a valid API key. Google offers two paths for accessing image generation through their developer platform:
- Google AI Studio: Sign in with your Google account at ai.google.dev, navigate to the API keys section, and generate a new key. The free tier gives you 50 requests per day across all resolutions.
- Google Cloud Vertex AI: For production workloads, create a project in Google Cloud Console, enable the Generative AI API, and use service account credentials. This path gives you higher rate limits and usage based billing.
Once you have your key, store it as an environment variable: export NANO_BANANA_API_KEY="your_key_here". Never hardcode API keys in your source files.
Making Your First API Call
The simplest way to generate an image is a POST request to the Gemini API endpoint. Here is a minimal cURL example that creates a photorealistic scene:
curl -X POST "https://generativelanguage.googleapis.com/v1/models/gemini-3-pro:generateContent" \
-H "Authorization: Bearer $NANO_BANANA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{"text": "Generate an image of a coastal village at golden hour, photorealistic, cinematic lighting"}]
}],
"generationConfig": {
"responseModalities": ["IMAGE", "TEXT"]
}
}'
The response includes a base64-encoded image in the parts array. Decode it and save to disk, similar to how other programmatic image generation platforms handle their output:
import base64, json
response = json.loads(raw_response)
image_data = response["candidates"][0]["content"]["parts"][0]["inlineData"]["data"]
with open("output.png", "wb") as f:
f.write(base64.b64decode(image_data))

Python SDK Integration
For a cleaner developer experience, use Google’s official Python client. The SDK abstracts away the HTTP details and works well alongside other AI workflow APIs:
from google import genai
client = genai.Client(api_key="your_key_here")
response = client.models.generate_content(
model="gemini-3-pro",
contents="A minimalist product photo of wireless earbuds on a marble surface, studio lighting",
config=genai.types.GenerateContentConfig(response_modalities=["IMAGE", "TEXT"])
)
for part in response.candidates[0].content.parts:
if hasattr(part, "inline_data"):
with open("earbuds.png", "wb") as f:
f.write(part.inline_data.data)
This approach works well for batch workflows. You can loop through a list of prompts, generate images for each, and upload them to your CDN or batch processing pipeline automatically.
Advanced Features: Editing and Inpainting
Nano Banana is not limited to text-to-image generation. You can also send an existing image alongside your prompt to request edits. This is useful for product photography, where you might want to swap backgrounds or adjust lighting on existing shots.
To edit an image, include it as a base64-encoded part in your request alongside a text instruction like “Change the background to a tropical beach at sunset”. The model interprets the combination and produces an edited version. This works well for background swaps, color adjustments, and adding or removing elements from scenes.
If you are building a product that needs image editing at scale, platforms that integrate Nano Banana into visual node-based workflows can chain generation, editing, and post-processing steps without writing boilerplate. You can check it out here to see how API calls map to drag-and-drop nodes.
Prompt Engineering Tips for Better Results
The quality of your output depends heavily on your prompts. Good prompt engineering follows a few consistent patterns:
- Be specific about lighting: “golden hour rim lighting” beats “nice lighting” every time. Nano Banana responds well to cinematography terms like “volumetric fog”, “soft diffused light”, and “backlit silhouette”.
- Specify the medium: Saying “oil painting” or “editorial photograph” guides the model toward a consistent style, similar to how FLUX prompt libraries organize style tokens.
- Use negative framing sparingly: Unlike some diffusion models, Nano Banana does not support a dedicated negative prompt field. Instead, phrase what you want positively.
- Reference real camera settings: Terms like “85mm lens, f/1.8, shallow depth of field” help produce natural bokeh and realistic depth.
- Iterate with edits: Generate a base image, then use the editing API to refine specific regions rather than re-rolling the entire image from scratch.
Rate Limits, Pricing, and Production Considerations
Understanding the cost and throughput constraints is important before committing to any image generation API for a production app.
| Tier | Requests per Day | Resolution | Cost |
|---|---|---|---|
| Free (AI Studio) | 50 | Up to 1024×1024 | $0 |
| Pay-as-you-go | Unlimited | Up to 2048×2048 | ~$0.02-0.04/image |
| Vertex AI Enterprise | Custom | Custom | Volume pricing |
For high volume use cases like generating product catalog images or social media content, the pay-as-you-go tier is the practical starting point. Batch your requests with async patterns to stay within rate limits and maximize throughput.

Frequently Asked Questions
What models are available in the Nano Banana family? Nano Banana 2 (Gemini 3.1 Flash) is optimized for speed and handles high volume workloads. Nano Banana Pro (Gemini 3 Pro) produces higher quality output for professional use. Both are accessible through the same API with different model identifiers.
Is Nano Banana free to use? The free tier through Google AI Studio provides 50 requests per day. For anything beyond prototyping, you will need the pay-as-you-go tier or a Vertex AI account.
Can I use Nano Banana for commercial projects? Yes. Google’s terms of service for the Generative AI API permit commercial use of generated images, provided you follow their acceptable use policy.
How does Nano Banana compare to FLUX for API-based generation? FLUX models (especially FLUX 1.1 Pro) tend to produce stronger results for artistic and stylized images. Nano Banana excels at photorealism and has a lower barrier to entry since it uses Google’s existing authentication. Both are solid choices depending on your aesthetic requirements.
What image formats does the API return? The API returns images as base64-encoded PNG data by default. You can convert to JPEG, WebP, or other formats client-side after decoding.
Can I send reference images for style transfer or editing? Yes. Include a base64-encoded image in the request alongside your text prompt. The model interprets the combination and produces an edited or style-transferred version of the input image.
What is the maximum resolution? The free tier supports up to 1024×1024. Paid tiers support up to 2048×2048, with aspect ratio variants available for landscape and portrait orientations.
Conclusion
Nano Banana gives developers a production-ready path to AI image generation through a clean, well documented API. The combination of text-to-image generation and image editing in a single endpoint makes it practical for workflows that go beyond simple prompt-to-image. For teams that want to integrate Nano Banana alongside other models like FLUX or Recraft in a unified pipeline, a workflow-based AI image platform can simplify the orchestration and eliminate the need to manage multiple API integrations manually.
