Nano Banana has quickly become one of the most talked-about AI image generation models of 2026. Built on Google DeepMind's Gemini architecture, it offers three tiers of image generation quality, from fast prototyping to production-grade 4K output. For developers who need to generate images programmatically, calling the model through an API is the most practical path.
This guide covers the full process: choosing the right Nano Banana tier, setting up your API key, writing requests, handling responses, and building reliable image pipelines. If you are new to AI image generation APIs in general, start here and work through each section in order.
Understanding the Nano Banana Model Family
Google DeepMind released Nano Banana as a family of image generation models, each sitting on a different Gemini foundation. The three tiers serve different use cases and budgets, so choosing the right one before writing any code saves both time and money. You can explore the Nano Banana model page for live generation examples.
- Nano Banana (Gemini 2.5 Flash): roughly $0.04 per image, up to 1K resolution. Best for thumbnails, prototyping, and high-volume batch jobs.
- Nano Banana 2 (Gemini 3.1 Flash): about $0.07 per generation, under 10 seconds. Handles standard product shots and social media assets well. Model ID:
gemini-3.1-flash-image-preview. - Nano Banana Pro (Gemini 3 Pro): up to 4K resolution, best-in-class text rendering, strong multi-subject consistency. Around $0.13 at 2K, $0.24 at 4K. Model ID:
gemini-3-pro-image-preview.
For most API integrations, Nano Banana 2 is the practical default. Move to Pro only when the task demands text overlays, higher resolution, or complex scene composition. You can read more about how different API tiers compare across platforms.
Getting Your API Key
There are two main ways to access Nano Banana via API. The most direct path is through Google AI Studio. Sign in with a Google account, create a project, enable the Gemini API, and generate an API key. Google provides 50 free requests per day across all Nano Banana tiers, which is enough for initial development and testing.
The second path is through a third-party platform that wraps Nano Banana (and other models) behind a unified endpoint. Platforms like wireflow.ai offer this kind of multi-model access, which is useful when your pipeline chains image generation with editing, upscaling, or video models. API keys from these platforms typically start with sk- and are generated from a dashboard settings page.
Store your key in an environment variable, never hardcode it. A .env file works for local development; use your cloud provider's secret manager for production. The same principle applies whether you are calling Nano Banana or any other image generation model.

Writing Your First API Request
Here is a minimal curl example that generates an image using the Google Gemini API with Nano Banana 2. This pattern is similar to how you would call Flux 2 from code, though the authentication and payload structure differ:
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{
"text": "A golden retriever sitting in a sunlit meadow, photorealistic, 4K"
}]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"]
}
}'
The response returns a JSON object containing base64-encoded image data in the parts array. Decode the base64 string and save it as a PNG or JPEG file. For Python developers, the google-genai SDK simplifies this to a few lines. Check the Flux API pricing examples for a side-by-side comparison of how different model APIs handle authentication.
For production use, wrap the request in retry logic. Nano Banana's API occasionally returns 503 during high-traffic periods. A simple exponential backoff starting at 1 second and capping at 10 seconds handles most transient failures. If you are building a full REST-based AI pipeline, this retry pattern should be part of your shared HTTP client.
Prompt Engineering for Nano Banana
The quality gap between a vague prompt and a structured one is significant with Nano Banana. These techniques consistently produce better results.
Be specific about composition. Instead of "a city," write "an aerial view of a dense urban skyline with glass towers reflecting a pink sunset, shot from 200 meters." Nano Banana Pro responds well to camera angle and lighting instructions, treating them almost like a real photography brief. This specificity also helps when creating professional AI headshots.
Include technical parameters in the prompt itself. Words like "photorealistic," "8K," "cinematic lighting," or "macro lens" guide the model's style decisions. This is separate from the API parameters (resolution, aspect ratio) which control the output dimensions. For a deeper look at how prompt parameters affect output across models, see this AI image editor comparison.
Use text rendering (Pro only). Nano Banana Pro can render legible text in multiple languages. Include the text you want directly in your prompt: "A coffee shop menu board reading 'Morning Specials' in chalk lettering." The base and 2.0 tiers have limited text capability.
Use positive descriptions. Rather than "no blurry edges," describe what you want: "crisp, sharp focus on the subject with soft background bokeh." Nano Banana responds better to positive framing than negative constraints. The same principle applies when using prompts for AI photo enhancement.

Handling Errors, Rate Limits, and Cost Control
Every API integration needs error handling. Here are the status codes you will encounter most often with Nano Banana, similar to what you see when building API-driven workflows:
- 200/201: success. Process the response normally.
- 400: malformed request. Check your JSON structure and required fields.
- 402: insufficient credits (on third-party platforms). Check your balance before retrying.
- 429: rate limited. The response includes a
Retry-Afterheader. Pause for that duration before sending the next request. - 503: temporary server overload. Retry once after a short delay.
Google AI Studio's free tier caps at 50 requests per day and 10 per minute. Paid plans on Google Cloud raise these limits significantly. For batch image generation at scale, consider queuing requests with a rate limiter that respects these ceilings.
Cost control matters when generating images at volume. Track spending programmatically by logging each request's model tier, resolution, and timestamp. Set daily caps in your application layer rather than waiting for the API to reject you. Some orchestration platforms offer built-in spend limits, which simplifies this for teams running production AI workflows.
Scaling to Production Pipelines
Once basic generation works, the next step is integrating Nano Banana into a larger pipeline. These patterns cover the most common production scaling approaches:
Batch processing. Read prompts from a CSV or database, generate images in parallel (respecting rate limits), and store results in cloud storage. This is how e-commerce teams generate hundreds of product shots from a single template prompt. The batch generation via API guide covers this pattern in detail.
Multi-model chaining. Generate a base image with Nano Banana 2 (low cost), then pass the result through an editing model for refinement or an upscaler for higher resolution. A multi-model AI workflow tool can handle this orchestration without custom code, connecting generation, editing, and post-processing nodes in a visual pipeline.
Webhook-driven generation. Instead of polling for results, set up a webhook URL that receives the completed image. This works well for asynchronous applications where a user submits a prompt and checks back later. You can also use webhooks to animate still images automatically after generation.
Image-to-image workflows. Both Nano Banana 2 and Pro accept a reference image alongside a text prompt. This enables style transfer, photo editing, and reference-based generation. Upload the reference image first, then include its URI in the request alongside your text prompt. This is particularly useful for changing photo backgrounds or converting images to different styles.

Frequently Asked Questions
What resolution does Nano Banana Pro support?
Nano Banana Pro generates images up to 4K resolution. You can request 1K, 2K, or 4K in your API parameters. Higher resolutions cost more per image: roughly $0.13 for 1K/2K and $0.24 for 4K. For comparison, see how other API pricing models stack up.
Is there a free tier for the Nano Banana API?
Yes. Google AI Studio provides 50 free requests per day across all Nano Banana tiers, including Pro at full resolution. That works out to about 1,500 free generations per month with just a Google account.
Can Nano Banana render readable text inside images?
Nano Banana Pro has strong text rendering capability and can produce legible text in multiple languages, including longer passages. The base model and Nano Banana 2 have limited text rendering. If text overlays are critical to your use case, Pro is the tier you need.
How do I handle API timeouts?
Use the asynchronous execution pattern: send your generation request, then poll a status endpoint or listen for a webhook callback. If no response arrives within 60 seconds, check the execution status endpoint for error details. Always include an idempotency key to prevent duplicate charges on retries. The same pattern applies when generating videos via API.
What is the difference between Nano Banana 2 and Nano Banana Pro?
Nano Banana 2 runs on Gemini 3.1 Flash and is optimized for speed and cost. It generates standard-quality images in under 10 seconds. Nano Banana Pro runs on Gemini 3 Pro and offers higher resolution (up to 4K), better text rendering, and stronger multi-subject consistency. Pro costs roughly twice as much per image but produces noticeably better results for professional assets.
Can I chain Nano Banana with other AI models?
Yes. Using a workflow-based API or orchestration platform, you can connect Nano Banana output to editing models (Flux 2 Edit), video generators (Kling 2.5, Seedance), or utility steps like prompt manipulation and format conversion. Each node's output feeds into the next automatically. See how to turn images into video for a practical example.
Does Nano Banana support image-to-image generation?
Both Nano Banana Pro and Nano Banana 2 accept an optional reference image alongside a text prompt. This enables style transfer, controlled editing, and reference-based generation. Pass the image data as a base64 part or a file URI in the contents array.
Wrapping Up
Nano Banana fills a clear gap in the AI image generation landscape: a model family that scales from cheap prototyping to production-grade output, all accessible through a standard REST API. The three-tier structure means you can start with the free tier on Google AI Studio, validate your pipeline with Nano Banana 2, and upgrade to Pro only for the images that justify the cost. Explore the full BasedLabs model catalog to see how Nano Banana compares with Flux, Recraft, and other options.
For teams combining Nano Banana with other models, platforms that support multi-model orchestration reduce integration effort significantly. Choose the right tier for each step, handle rate limits gracefully, and structure prompts with specificity.
