# Nano Banana 2 & Pro Image Editor & Generator (`pnda/nano-banana-generator`) Actor

Edit photos by prompt or generate images with Google Nano Banana 2, Nano Banana 2 Lite and Nano Banana Pro (Gemini 3 Pro Image), up to 4K. No API key, paid Apify plans only, pay per successful image.

- **URL**: https://apify.com/pnda/nano-banana-generator.md
- **Developed by:** [PNDA](https://apify.com/pnda) (community)
- **Categories:** AI, Automation, E-commerce
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $130.00 / 1,000 image (nano banana 2 lite)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Nano Banana 2 & Pro Image Editor & Generator

**Nano Banana image editor and generator**: edit photos with a sentence or create images from text with Google **Nano Banana 2 Lite**, **Nano Banana 2** and **Nano Banana Pro** (Gemini 3 Pro Image), up to **4K**.

- ✏️ **Image editing**: give a public image URL and describe the change ("replace the background with a beach", "make the jacket red").
- 🎨 **Text-to-image**: leave the image URL empty and describe the picture you want.
- 🖼️ **1K, 2K or 4K**, 12 aspect ratios, up to 10 variants per run, permanent Apify-hosted image URLs.
- 🔑 **No API key**: no Replicate, OpenAI, Google or ByteDance account needed.
- 💳 **Paid Apify plans only.** Runs from a free plan stop immediately with an upgrade message, at no cost.
- 💸 **Pay only for successful outputs.** Failures are never charged.

Works from the Apify Console, the API, the JavaScript / Python clients, **n8n, Make, Zapier** and **AI agents / MCP**.

### 💡 Who is it for?

- E-commerce: packshots to lifestyle scenes, color variants, background swaps
- Marketing: ads, Stories, banners
- Developers and AI agents: a synchronous Nano Banana API without keys or polling

### ⚙️ How it works

1. You send a **prompt**, plus an image URL if you want to edit a picture, and pick a model.
2. The Actor generates each output and waits for the result (no task id to poll).
3. Each file is **copied to your Apify key-value store**, so the link does not expire after an hour.
4. One dataset row per output: URL, model, options.

### 💰 Pricing

**Available on paid Apify plans only.** Pay per event, one event per successful output, no start fee:

| Model | Option | Event | Price per output |
|---|---|---|---|
| Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image) | — | `image-standard` | $0.13 |
| Nano Banana 2 (Gemini 3.1 Flash Image) | 1K | `image-pro` | $0.26 |
| Nano Banana 2 (Gemini 3.1 Flash Image) | 2K | `image-premium` | $0.39 |
| Nano Banana 2 (Gemini 3.1 Flash Image) | 4K | `image-ultra` | $0.57 |
| Nano Banana Pro (Gemini 3 Pro Image) | 1K | `image-ultra` | $0.57 |
| Nano Banana Pro (Gemini 3 Pro Image) | 2K | `image-ultra` | $0.57 |
| Nano Banana Pro (Gemini 3 Pro Image) | 4K | `image-ultra-4k` | $1.13 |

- A failed output is **not charged**; a run where nothing could be produced is marked **Failed** and nothing is charged.
- Set a **maximum cost per run**: the Actor stops *before* generating an output your budget would not cover.

### 📥 Input

| Field | Type | Description |
|---|---|---|
| `prompt` | string | Text description of the image to generate, or the edit to make to the source image. |
| `model` | string | Which AI model to use. Each option is billed at its own price, see the Pricing section of the README. |
| `imageUrl` | string | Public URL of an image to edit (or to upscale). Leave empty for text-to-image. |
| `aspectRatio` | string | Output aspect ratio. "auto" keeps the model default (for edits: the source image ratio). Not every model supports every ratio; an unsupported ratio stops the run before anything is charged. |
| `resolution` | string | Output resolution for models that offer it (Nano Banana 2 / Pro). Leave empty for 1K. 2K and 4K cost more. |
| `numberOfVariants` | integer | How many separate outputs to generate (1 to 10). Each successful one is billed; failures are free. |
| `includeFailedVariants` | boolean | Also write failed outputs (with the reason) to the dataset. Failed outputs are never billed. |

#### Example: Edit a photo (Nano Banana 2 Lite)

```json
{
  "prompt": "Replace the background with a sunny tropical beach, keep the product identical",
  "imageUrl": "https://example.com/my-product.jpg",
  "model": "google/nano-banana-2-lite"
}
```

#### Example: Text-to-image in 4K (Nano Banana Pro)

```json
{
  "prompt": "A ripe yellow banana on a white marble table, studio product photo",
  "model": "google/nano-banana-pro",
  "resolution": "4K",
  "aspectRatio": "16:9"
}
```

### 📤 Output

One dataset row per output:

```json
{
  "model": "google/nano-banana-2-lite",
  "mode": "text-to-image",
  "index": 1,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/image-1",
  "contentType": "image/png",
  "chargedEvent": "image-standard",
  "chargedUnits": 1,
  "success": true
}
```

Export the dataset as **JSON, CSV, Excel or HTML**, or read it from the API.

### 🧠 Models

- **Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)** (`google/nano-banana-2-lite`): optional edit image, 12 aspect ratios.
- **Nano Banana 2 (Gemini 3.1 Flash Image)** (`google/nano-banana-2`): optional edit image, resolutions 1K / 2K / 4K, 12 aspect ratios.
- **Nano Banana Pro (Gemini 3 Pro Image)** (`google/nano-banana-pro`): optional edit image, resolutions 1K / 2K / 4K, 10 aspect ratios.

### 🛟 Errors and reliability

- Invalid options (unsupported ratio, duration or resolution for the chosen model) stop the run **before** anything is generated or charged, with a message listing the supported values.
- If the generation service is temporarily unavailable, the run stops right away with a clear message instead of burning time on the remaining outputs.
- If one output is refused (safety filter, unreadable source image), the others still run.

### ❓ FAQ

**Which Gemini model is behind each option?**

Nano Banana 2 Lite = Gemini 3.1 Flash Lite Image, Nano Banana 2 = Gemini 3.1 Flash Image, Nano Banana Pro = Gemini 3 Pro Image.

**Do I need an API key (Replicate, OpenAI, Google...)?**

No. Your Apify account is enough: no key, no subscription, no quota to manage.

**Can I use it on the free Apify plan?**

No. This Actor is available on **paid Apify plans only**. Runs started from a free plan stop immediately with an upgrade message, at no cost.

**Am I charged when a generation fails?**

No. You pay only for outputs that are delivered. Invalid inputs are rejected before any generation starts.

**How do I cap my spending?**

Set **Maximum cost per run** in the run options. The Actor stops before generating an output your budget would not cover.

**How long are files kept?**

Outputs are copied to the run key-value store and follow your Apify data retention. Download them or copy them to your own storage for long-term use.

**Can I call it from code, n8n, Make, Zapier or an AI agent?**

Yes. Use the "Run Actor synchronously and get dataset items" API endpoint, the Apify clients, the integrations, or the Apify MCP server.

**Who owns the generated content?**

Use of generated content is subject to the terms of each model provider. Do not submit images you do not have the right to use.

### ▶️ Start now

Pick a model, type a prompt, click **Start**.

# Actor input Schema

## `prompt` (type: `string`):

Text description of the image to generate, or the edit to make to the source image.

## `model` (type: `string`):

Which AI model to use. Each option is billed at its own price, see the Pricing section of the README.

## `imageUrl` (type: `string`):

Public URL of an image to edit (or to upscale). Leave empty for text-to-image.

## `aspectRatio` (type: `string`):

Output aspect ratio. "auto" keeps the model default (for edits: the source image ratio). Not every model supports every ratio; an unsupported ratio stops the run before anything is charged.

## `resolution` (type: `string`):

Output resolution for models that offer it (Nano Banana 2 / Pro). Leave empty for 1K. 2K and 4K cost more.

## `numberOfVariants` (type: `integer`):

How many separate outputs to generate (1 to 10). Each successful one is billed; failures are free.

## `includeFailedVariants` (type: `boolean`):

Also write failed outputs (with the reason) to the dataset. Failed outputs are never billed.

## Actor input object example

```json
{
  "prompt": "Replace the background with a sunny tropical beach, keep the product identical",
  "model": "google/nano-banana-2-lite",
  "aspectRatio": "auto",
  "numberOfVariants": 1,
  "includeFailedVariants": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

All generated records (JSON, CSV, Excel).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "prompt": "Replace the background with a sunny tropical beach, keep the product identical",
    "model": "google/nano-banana-2-lite",
    "numberOfVariants": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pnda/nano-banana-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "prompt": "Replace the background with a sunny tropical beach, keep the product identical",
    "model": "google/nano-banana-2-lite",
    "numberOfVariants": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("pnda/nano-banana-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "prompt": "Replace the background with a sunny tropical beach, keep the product identical",
  "model": "google/nano-banana-2-lite",
  "numberOfVariants": 1
}' |
apify call pnda/nano-banana-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pnda/nano-banana-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ucNmRD4AQfs8zGE0d/builds/0uxILEIlsuAp1INiw/openapi.json
