The Nano Banana 2 API Key (2026): Setup, Pricing and Code
Unicorn API Team · · 11 min read
A Nano Banana 2 API key is the credential that lets your own code call Google’s Nano Banana 2 image model directly, so you can generate and edit images from a script, a backend or an app instead of a chat window. You can get access from Google itself or from a platform that serves the model behind its own API. This article covers both routes, then walks through creating a key on Unicorn API, sending your first request, and working out the exact cost of each image before you spend anything.
What is Nano Banana 2?
“Nano Banana” is the nickname for Google’s Gemini image models. The name stuck after the first version went viral, and Google kept it for each release. There are now four models in the family, and knowing which one you mean matters because they differ in price, resolution and how many reference images they accept. A reference image is a picture you send alongside your prompt so the model can edit it, copy its style or keep a character or product consistent.
- Nano Banana (officially Gemini 2.5 Flash Image), released August 2025: quick, natural-looking images and edits with up to 3 reference images.
- Nano Banana Pro (officially Gemini 3 Pro Image), released November 2025: high-fidelity images with accurate text rendering at 1K, 2K or 4K, up to 8 reference images.
- Nano Banana 2, released February 2026: Google’s current Gemini image model, with strong realism, text and edits at 1K, 2K or 4K, and up to 14 reference images.
- Nano Banana 2 Lite, released July 2026: the cheapest Gemini image model, fast 1K images and edits with up to 10 reference images.
“1K”, “2K” and “4K” describe output resolution: roughly 1,000, 2,000 and 4,000 pixels along the long edge. 1K is fine for web thumbnails and social posts; 4K is for print, large hero banners or anything you plan to crop heavily.
| Model | Model id | Resolutions | Max reference images | Credits per image |
|---|---|---|---|---|
| Nano Banana | nano-banana | Set via image_size | 3 | 4 |
| Nano Banana 2 Lite | nano-banana-2-lite | 1K | 10 | 4 |
| Nano Banana 2 | nano-banana-2 | 1K, 2K, 4K | 14 | 8 / 12 / 18 |
| Nano Banana Pro | nano-banana-pro | 1K, 2K, 4K | 8 | 18 / 18 / 24 |
Is there a Nano Banana Pro 2?
Searches for “nano banana 2 pro” and “nano banana pro 2” are common, but no model by that name is in the Unicorn API catalog today. People typing those phrases almost always want either Nano Banana 2 or Nano Banana Pro. Both are real, both are available, and both work with the same key, so you can test them side by side.
Where can you get a Nano Banana 2 API key?
There are two practical routes, and the right one depends on whether you only ever want Google models or want room to switch.
Route 1: directly from Google
Google serves its Gemini models through its own developer platform. The usual path is to create a Google Cloud project (or use Google’s AI Studio), enable the Generative Language API, attach billing, and generate a key. Requests then follow Google’s own request format, and billing lands on your Google account.
This route makes sense if your company already runs on Google Cloud and wants everything under one cloud bill. The trade-off: a Google key only reaches Google models. If you later want to compare Nano Banana 2 with an OpenAI or xAI image model, that means another account, another key, another SDK and another invoice.
Route 2: one key for many models
API platforms such as Unicorn API serve Nano Banana 2 alongside other vendors’ models behind a single interface. You create one key, and the same request shape works for every image model: change the model string and the rest of your code stays put. Billing is in credits, and you can ask for the exact price of a request before running it.
| Google directly | Unicorn API | |
|---|---|---|
| Setup | Cloud project, enable API, billing, key | Account, plan or top-up, key |
| Models the key reaches | Google models | Every model in the catalog (image, video, audio, chat) |
| Request style | Google’s format | One job API for all media models |
| Billing | Google Cloud bill | Credits on one bill |
| Price before running | Calculate from Google’s price list | POST /v1/models/price returns the exact cost |
Either way, the Nano Banana 2 API key is a secret, and the handling advice later in this article applies to both.

How to get a Nano Banana 2 API key on Unicorn API
The whole process takes a few minutes. You need an account with credits and a key.
- Pick a plan or buy a top-up. Monthly plans give credits at $0.01 each: Starter $25, Creator $50, Studio $100 and Pro $200 per month. Top-up credits cost $0.015 each and never expire, which suits occasional or unpredictable usage. Details are on the pricing page.
- Create the key. Go to the keys page and generate a new key. Give it a name that says where it will live, such as “prod-backend” or “local-dev”. Copy it immediately and treat it like a password.
- Store it as an environment variable. On macOS or Linux:
export UNICORN_API_KEY="your-key-here". In production, put it in your host’s secrets settings or a secrets manager rather than a file in your repository. - Try the model in the browser (optional). The image playground runs Nano Banana 2 with the same credits, which is a quick way to iterate on a prompt before you write code.
- Check the price, then send a request.
POST /v1/models/pricereturns the exact credit cost of a request before you run it. The request body is in the API documentation. Then create a job, as shown in the next section.
The same Nano Banana 2 API key also works inside coding agents. If you use Cursor, Claude Code or another tool that supports MCP (the Model Context Protocol, a standard way for agents to call external tools), the agents page shows how to connect it so your agent can generate images while it builds your app.
Your first Nano Banana 2 request (with code)
Image generation on Unicorn API is asynchronous: a request creates a job and returns straight away, the model renders in the background, and you poll the job until it is finished. This keeps your HTTP connection from hanging while a 4K image renders. The flow is:
POST /v1/jobswith a model id and aninputobject. You get back a job with anid.GET /v1/jobs/{id}every couple of seconds untilstatusis"succeeded".- Read the image URL from
outputs[0].urland download or store it.
curl
# 1. Create the job
curl -X POST https://api.unicornapi.net/v1/jobs \
-H "Authorization: Bearer $UNICORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"input": {
"prompt": "A red fox resting in a snowy forest at dawn, soft light, highly detailed",
"resolution": "2K",
"aspect_ratio": "16:9"
}
}'
# 2. Poll it (replace JOB_ID with the id from step 1)
curl https://api.unicornapi.net/v1/jobs/JOB_ID \
-H "Authorization: Bearer $UNICORN_API_KEY"
Python
This script creates a job, polls with a timeout, and saves the image. It uses only the requests library.
import os
import time
import requests
API = "https://api.unicornapi.net"
HEADERS = {
"Authorization": f"Bearer {os.environ['UNICORN_API_KEY']}",
"Content-Type": "application/json",
}
def generate(prompt, resolution="1K", aspect_ratio="1:1", timeout=300):
body = {
"model": "nano-banana-2",
"input": {
"prompt": prompt,
"resolution": resolution,
"aspect_ratio": aspect_ratio,
},
}
r = requests.post(f"{API}/v1/jobs", json=body, headers=HEADERS)
r.raise_for_status()
job = r.json()
deadline = time.time() + timeout
while job["status"] != "succeeded":
if job["status"] in ("failed", "error"):
raise RuntimeError(f"Job {job['id']} failed: {job}")
if time.time() > deadline:
raise TimeoutError(f"Job {job['id']} still {job['status']}")
time.sleep(2)
r = requests.get(f"{API}/v1/jobs/{job['id']}", headers=HEADERS)
r.raise_for_status()
job = r.json()
return job["outputs"][0]["url"]
if __name__ == "__main__":
url = generate(
"A red fox resting in a snowy forest at dawn, soft light, highly detailed",
resolution="2K",
aspect_ratio="16:9",
)
img = requests.get(url)
with open("fox.png", "wb") as f:
f.write(img.content)
print("Saved fox.png from", url)
JavaScript (Node 18+)
const API = "https://api.unicornapi.net";
const headers = {
Authorization: `Bearer ${process.env.UNICORN_API_KEY}`,
"Content-Type": "application/json",
};
async function generate(prompt) {
let res = await fetch(`${API}/v1/jobs`, {
method: "POST",
headers,
body: JSON.stringify({
model: "nano-banana-2",
input: { prompt, resolution: "1K", aspect_ratio: "1:1" },
}),
});
let job = await res.json();
while (job.status !== "succeeded") {
if (["failed", "error"].includes(job.status)) {
throw new Error(`Job ${job.id} failed`);
}
await new Promise((r) => setTimeout(r, 2000));
res = await fetch(`${API}/v1/jobs/${job.id}`, { headers });
job = await res.json();
}
return job.outputs[0].url;
}
generate("A minimalist coffee shop logo with the word BEAN in bold serif type")
.then((url) => console.log(url))
.catch(console.error);
Editing with reference images
To edit a photo or keep a product consistent across shots, add ref_images to the input with your source images, and describe the change in the prompt (“place this bottle on a marble counter, morning window light”). Nano Banana 2 accepts up to 14 reference images per request, more than Nano Banana Pro (8) or Nano Banana 2 Lite (10). The exact format for passing images is in the docs.

How much does Nano Banana 2 cost per image?
Price depends on resolution only. The credit cost is per output image, multiplied by n if you ask for several images in one request, and rounded up to whole credits.
| Resolution | Credits per image | On a monthly plan ($0.01/credit) | With top-up credits ($0.015/credit) |
|---|---|---|---|
| 1K | 8 | $0.08 | $0.12 |
| 2K | 12 | $0.12 | $0.18 |
| 4K | 18 | $0.18 | $0.27 |
If you leave out resolution, the request is billed at the 1K rate of 8 credits.
A worked example
Say you run a small online store and need 200 product images at 2K for your listings, one image per request:
- 200 images × 12 credits = 2,400 credits.
- On the Starter plan ($25 for 2,500 credits), that fits with 100 credits to spare, so the batch costs $24 of plan credit.
- With top-up credits only, the same batch is 2,400 × $0.015 = $36.
Now suppose you want four variations of each product to choose from, at 1K, by setting n to 4. Each request costs 4 × 8 = 32 credits, so 200 products come to 6,400 credits: comfortably inside the Pro plan, or across a Studio plan plus a top-up. A common pattern is to explore at 1K with several variations, then re-render only the winners at 2K or 4K. That keeps most of your spend on the cheapest tier.
Check before you run
For anything automated, call POST /v1/models/price first. It returns the exact credit cost of the request you are about to send, which is useful for showing users a price in your own app, enforcing a budget per customer, or catching a bug where n got set to 40 instead of 4.
Nano Banana 2 vs Pro vs Lite: which should you call?
Because one Nano Banana 2 API key on Unicorn API reaches every model in the family, choosing between them is a matter of changing the model string. Here is how they compare on the facts that affect a build decision.
| Nano Banana 2 Lite | Nano Banana 2 | Nano Banana Pro | |
|---|---|---|---|
| Credits at 1K | 4 | 8 | 18 |
| Credits at 2K | Not offered | 12 | 18 |
| Credits at 4K | Not offered | 18 | 24 |
| Reference images | Up to 10 | Up to 14 | Up to 8 |
| Aspect ratios | 16:9, 1:1, 9:16, 21:9, 4:3, 3:2, 2:3 | 16:9, 1:1, 9:16, 21:9, 4:3, 3:2, 2:3 | 16:9, 1:1, 9:16, 21:9, 4:3 |
| Best for | High volume, drafts, thumbnails | Most production work | Maximum fidelity and precise text |
Nano Banana 2 vs Pro
This is the comparison most people search for. Nano Banana 2 is the newer model, costs less than half as much at 1K, accepts more reference images and supports the 3:2 and 2:3 photo ratios that Pro lacks. Pro is the high-fidelity option, built around accurate text rendering, and at 4K the gap narrows to 18 versus 24 credits. A sensible default is Nano Banana 2 for everything, with Pro reserved for the few images where a side-by-side test shows a visible difference, such as dense typography on a poster.
When Lite is enough
Nano Banana 2 Lite runs at half the price of Nano Banana 2 at 1K. If your output only ever appears small (chat avatars, feed thumbnails, internal mockups) or you are generating many drafts to filter, Lite is the efficient choice. Its limit is resolution: it only produces 1K.
Outside the Nano Banana family
The same key also reaches other vendors, which is handy for comparison. GPT Image 2.5 Flare from OpenAI costs 6, 10 or 16 credits at 1K, 2K or 4K and accepts up to 16 reference images; GPT Image 2.5 Sunburst is the slower, more polished variant at the same price. Grok Imagine 2 from xAI produces vivid, stylised images at 4 credits each. Running one prompt through two or three of these costs a few cents and usually settles the question faster than reading reviews.
Common mistakes with a Nano Banana 2 API key
Most problems people hit are not model problems. They come from how the key and the requests are handled.
- Putting the key in frontend code. Anything shipped to a browser or mobile app can be read by users. Call the API from your server and send the finished image URL to the client. Treat a leaked Nano Banana 2 API key like a leaked password: revoke it at /keys and create a new one.
- Committing the key to Git. Even in a private repository, keys in history tend to escape. Use environment variables and add
.envto.gitignore. - One key everywhere. Create separate keys for local development, staging and production. Then a leak or a runaway script in one place can be shut off without taking down the others.
- Expecting the image in the first response. The create call returns a job, not an image. Code that reads
outputsstraight after the POST will find nothing. Poll untilstatusis"succeeded". - Polling without a timeout. A loop with no exit condition can hang a worker forever if something goes wrong. Add a deadline and handle failed jobs, as in the Python example.
- Forgetting that
nmultiplies the price. Four images at 4K is 72 credits, not 18. Check the price endpoint in any code path wherenorresolutioncomes from user input. - Sending an unsupported aspect ratio. Nano Banana 2 accepts 16:9, 1:1, 9:16, 21:9, 4:3, 3:2 and 2:3. Nano Banana Pro does not accept 3:2 or 2:3, so code that switches models should also validate the ratio.
- Too many reference images. The limits differ by model: 14 for Nano Banana 2, 10 for Lite, 8 for Pro, 3 for the original Nano Banana. Trim the list when you fall back to a different model.
- Rendering everything at 4K. 4K costs more than twice as much as 1K. Draft at 1K, then upscale only the images you keep by re-running them at a higher resolution.
Next steps
To recap the shortest path: buy a plan or top-up on the pricing page, create your Nano Banana 2 API key at /keys, export it as UNICORN_API_KEY, and run the Python script above with your own prompt. If you would rather see results before writing any code, open the image playground, find a prompt that works, then move it into your app unchanged.
From there, the useful habits are the ones covered above: check prices before automated runs, keep keys server-side, draft at 1K and re-render winners, and test Pro or Lite only where your own results justify it. For editing workflows, product photography or anything involving consistent characters, explore ref_images early, since Nano Banana 2’s 14-image limit is where it stands apart from the rest of its family.
Frequently asked questions
What is Nano Banana 2?
Nano Banana 2 is Google's current Gemini image model, released in February 2026. It generates and edits images from text prompts at 1K, 2K or 4K resolution, renders text inside images well, and accepts up to 14 reference images for edits and consistent characters or products. It sits between the cheaper Nano Banana 2 Lite and the higher-fidelity Nano Banana Pro in Google's lineup.
How much does Nano Banana 2 cost per image through an API?
On Unicorn API, Nano Banana 2 costs 8 credits per image at 1K, 12 at 2K and 18 at 4K. Monthly plans price credits at $0.01, so that is $0.08, $0.12 or $0.18 per image. Top-up credits cost $0.015 each and never expire. If you set n to generate several images, the cost multiplies by n.
Nano Banana 2 vs Pro: which should I use?
Use Nano Banana 2 for most work: it is cheaper at every resolution (8 credits at 1K versus 18 for Pro), supports more reference images (14 versus 8) and offers 3:2 and 2:3 aspect ratios. Pick Nano Banana Pro when a specific image needs maximum fidelity or very precise text rendering and the extra cost is justified. Run the same prompt through both before committing.
Is there a Nano Banana Pro 2?
No model called Nano Banana Pro 2 is available in the Unicorn API catalog today. Searches for "nano banana 2 pro" or "nano banana pro 2" usually mean one of two real models: Nano Banana 2 (model id nano-banana-2) or Nano Banana Pro (model id nano-banana-pro). Both work with the same Unicorn API key, so you can switch by changing one string.
Can I use one API key for Nano Banana 2 and other image models?
Yes. A Unicorn API key works for every model in the catalog, including Nano Banana 2, Nano Banana Pro, GPT Image 2.5 Flare and Grok Imagine 2. The request shape stays the same: POST /v1/jobs with a model id and an input object, then poll the job. Switching models means changing the model field, not adding a new account or SDK.
How do I keep my Nano Banana 2 API key safe?
Store the key in an environment variable or a secrets manager, never in source code or a public repository. Call the API only from your server, not from browser JavaScript, because anything shipped to the browser can be read by users. Use separate keys for development and production so you can revoke one without breaking the other.