# Nano Banana 2.1 Image Generator & Editor (`superlewis/nano-banana-image-generator`) Actor

Generate and edit images with Nano Banana 2.1 in native 1K, 2K or 4K. Text to image, or up to 10 reference images for editing and fusing. Pay per image on Apify, or use your own apimodels.app API key.

- **URL**: https://apify.com/superlewis/nano-banana-image-generator.md
- **Developed by:** [Lucas Lewis](https://apify.com/superlewis) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $28.00 / 1,000 1k images

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.1 image generator and editor

Generate and edit images with **Nano Banana 2.1** from a list of prompts, in native **1K, 2K or 4K**. Work from text alone, or add up to 10 reference images to edit a photo, keep a character or product consistent, or fuse several images into one. Each image comes back as a URL in a dataset.

The Actor runs on the [apimodels.app Nano Banana 2.1 API](https://apimodels.app/docs/nano-banana-2-1?utm_source=apify\&utm_medium=referral), which routes each request across several upstream channels and falls back automatically when one is slow or down.

### What it does

| | |
|---|---|
| Output size | Native 1K, 2K or 4K |
| Aspect ratio | Auto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1 |
| Inputs | Text, or text plus up to 10 reference image URLs |
| Images per prompt | One. Add more prompts for more images (up to 50 per run) |

### Pricing

Billed per delivered image. **Failed generations and moderation rejections are never charged.** Reference images are included at no extra cost.

**Pay per image on Apify** (paid Apify plans, no API key needed):

| Resolution | Per image | 100 images |
|---|---|---|
| 1K | $0.028 | $2.80 |
| 2K | $0.045 | $4.50 |
| 4K | $0.075 | $7.50 |

**Or use your own apimodels.app API key.** Create a key at [apimodels.app](https://apimodels.app/console/api-keys?utm_source=apify\&utm_medium=referral) and paste it into the input. Images are then billed to your apimodels.app balance at [apimodels.app prices](https://apimodels.app/models/nano-banana-2-1?utm_source=apify\&utm_medium=referral), and nothing is charged on Apify. **On the Apify free plan an API key is required.**

### How to use

1. Enter one or more prompts. Each prompt makes one image.
2. Pick the resolution and aspect ratio.
3. Optional: add reference image URLs to edit or fuse. Say in the prompt what to change, or what each image should supply.
4. Optional: paste your apimodels.app API key.
5. Start the run. Images appear in the **Output** tab as they finish.

### Input example

```json
{
  "prompts": ["Put the sneaker from image 1 on the rock in image 2, golden hour light, keep the logo sharp"],
  "resolution": "2K",
  "aspectRatio": "16:9",
  "referenceImageUrls": ["https://example.com/sneaker.jpg", "https://example.com/rock.jpg"]
}
```

### Output

One dataset item per image:

```json
{
  "ok": true,
  "imageUrl": "https://r2.apimodels.app/images/....png",
  "prompt": "Put the sneaker from image 1 on the rock in image 2, golden hour light, keep the logo sharp",
  "model": "nano-banana-2-1",
  "resolution": "2K",
  "aspectRatio": "16:9",
  "references": 2,
  "billing": "apify",
  "taskId": "..."
}
```

Failed jobs produce an item with `"ok": false` and an `error` message, and are not charged.

### Limits to know

- **Result links are kept for 30 days.** Download the files you want to keep.
- Reference images must be public URLs that load without login.
- The model applies content moderation; rejected prompts fail without a charge.
- Success is not guaranteed on every request. A failed job is reported per prompt and the rest of the run continues.
- With aspect ratio on Auto the model chooses the shape. Set a ratio when the shape matters.

### FAQ

**Is this the official Google API?** No. It is an independent service by apimodels.app that provides access to the Nano Banana 2.1 model.

**Can I generate several variations of one prompt?** Repeat the prompt in the list; each entry is one image.

**Can I use the results commercially?** You are responsible for how you use the output and for the rights to any reference images you supply.

**Something failed. Was I charged?** No. Only delivered images are charged, on Apify or on your apimodels.app balance.

# Actor input Schema

## `prompts` (type: `array`):

One image per prompt (up to 50 per run). When you add reference images, say what to change or what each image should supply.

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

Native output size. 4K takes longer than 1K.

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

Auto lets the model choose the shape. Set a ratio when the shape matters.

## `referenceImageUrls` (type: `array`):

Up to 10 public image URLs to edit or fuse. Leave empty for text to image. Included in the price.

## `apiKey` (type: `string`):

Leave empty on a paid Apify plan to pay per image on Apify. Required on the Apify free plan: create a key at https://apimodels.app/console/api-keys and images are billed to your apimodels.app balance instead (nothing is charged on Apify).

## Actor input object example

```json
{
  "prompts": [
    "A ceramic pour-over coffee set on a walnut table by a rainy window, soft morning light, shallow depth of field, editorial product photo"
  ],
  "resolution": "1K",
  "aspectRatio": "auto"
}
```

# Actor output Schema

## `results` (type: `string`):

One item per generated image with its URL (kept for 30 days) and settings, plus an error message for jobs that failed.

# 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 = {
    "prompts": [
        "A ceramic pour-over coffee set on a walnut table by a rainy window, soft morning light, shallow depth of field, editorial product photo"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("superlewis/nano-banana-image-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 = { "prompts": ["A ceramic pour-over coffee set on a walnut table by a rainy window, soft morning light, shallow depth of field, editorial product photo"] }

# Run the Actor and wait for it to finish
run = client.actor("superlewis/nano-banana-image-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 '{
  "prompts": [
    "A ceramic pour-over coffee set on a walnut table by a rainy window, soft morning light, shallow depth of field, editorial product photo"
  ]
}' |
apify call superlewis/nano-banana-image-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,superlewis/nano-banana-image-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/bpmHJrCMc3JAYqKHJ/builds/kZ1UtwyQAhPygcunV/openapi.json
