# AI Image Generator API: GPT Image 2 & Nano Banana Pro (`newpo/ai-image-generator`) Actor

AI image generator and text-to-image API: GPT Image 2, 2.5, 2.6 and Nano Banana Pro, up to 4K, with image editing from reference images. Real-time Standby API or bulk runs, from $0.06 per image at any size. No API key needed, failed images are free.

- **URL**: https://apify.com/newpo/ai-image-generator.md
- **Developed by:** [newpo](https://apify.com/newpo) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 105 total users, 86 monthly users, 94.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## AI Image Generator: GPT Image 2, GPT Image 2.6 and Nano Banana Pro, pay per image

**AI Image Generator** turns text prompts into images with **GPT Image 2**, **GPT Image 2.5**, **GPT Image 2.6** and
**Gemini 3 Pro Image (Nano Banana Pro)**. Paste one prompt or a thousand, pick a size up to **4K**, and get one
dataset row per image with a link to the file. Add reference images to **edit photos** or combine a product, a logo
and a background into one picture.

You don't need an OpenAI or Google API key. You pay **one flat price per image at any
size or quality, from $0.06**, and **failed images are free**. A **paid Apify plan** is required: runs from free
plans stop right away without generating or charging anything.

### Sample images

Made by this Actor with the input shown (JPEG output). Each cost one image price.

| Image | Model, price and prompt |
|---|---|
| ![Studio product photo of a matte ceramic coffee mug in sage g](https://api.apify.com/v2/key-value-stores/5lpsfm1Oaf2PSI1AZ/records/image-0001-1-0UoTWwNu.jpg?signature=1qSKFKvL9kqIiCCFfM8XT) | **GPT Image 2** · $0.06<br>*Studio product photo of a matte ceramic coffee mug in sage green on a light oak table, soft window light, shallow depth of field, minimal Scandinavian style* |
| ![Minimalist flat illustration of a lighthouse on a rocky coas](https://api.apify.com/v2/key-value-stores/5lpsfm1Oaf2PSI1AZ/records/image-0002-1-0UoTWwNu.jpg?signature=1rkwzxsOWTCNpWb4T7hka) | **GPT Image 2** · $0.06<br>*Minimalist flat illustration of a lighthouse on a rocky coast at dusk, pastel peach and teal palette, lots of empty sky for a headline* |
| ![A cozy Japanese ramen shop at night in the rain, neon sign t](https://api.apify.com/v2/key-value-stores/5lpsfm1Oaf2PSI1AZ/records/image-0001-1-svTtXaZq.jpg?signature=1bjHMeU2QhogYJH9kuUDN) | **GPT Image 2.6 Flare** · $0.08<br>*A cozy Japanese ramen shop at night in the rain, neon sign that reads "RAMEN", warm light spilling onto wet cobblestones, cinematic photo* |

### Why this image generator

- 💵 **One flat price per image.** A 4K wallpaper costs the same as a 1024×1024 thumbnail. You see the price before you start.
- 🆓 **Failed images are free.** You're charged only for images that were generated and saved. Refused prompts, timeouts and errors cost nothing.
- 📦 **Bulk prompts.** Up to 1,000 prompts per run and up to 10 images per prompt. Several images are generated at once.
- 🖼️ **Image editing and reference images.** Up to 16 reference images per prompt: put your product in a new scene, keep a character's look, or restyle a photo.
- 📐 **Any size up to 4K.** Square, 3:2, 2:3, 16:9, 9:16 (stories and reels), or a custom size up to 3840×2160.
- 🔒 **Your spending limit is respected.** The Actor never starts more images than your maximum cost per run allows.
- 🔗 **Links that work.** Every image is saved to a key-value store and linked from its dataset row. Download it, or save to a named store to keep it.

### Pricing

One price per image, the same for every size and quality. Generations and edits cost the same.

| Tier | Models | Price per image |
|---|---|---|
| **Standard** | GPT Image 2 (default), GPT Image 2.5 Flare, GPT Image 2.5 Sunburst | **$0.06** |
| **Premium** | GPT Image 2.6 Flare (default), GPT Image 2.6 Sunburst | **$0.08** |
| **Pro** | Gemini 3 Pro Image / Nano Banana Pro (default), Gemini 3.1 Flash Image / Nano Banana 2 | **$0.10** |

Examples:

| Job | Cost |
|---|---|
| 1 product shot, 1024×1024, Standard | $0.06 |
| 50 blog hero images, 1536×1024, Standard | $3.00 |
| 20 prompts × 4 variations, 4K, Premium | $6.40 |
| 10 Nano Banana Pro edits with 3 reference images each | $1.00 |

Apify adds a tiny start fee per run ($0.00005). Set **Maximum cost per run** in the run options to cap a run: the
Actor stops starting new images when the next one would go over, and the skipped prompts are listed in the dataset.

### How to use it

1. Enter your prompts, one per line.
2. Pick a tier, or a specific model.
3. Pick a size and the number of images per prompt.
4. Optional: add reference image URLs to edit or combine pictures.
5. Click **Start**. Each image usually takes 30 seconds to 2 minutes; prompts run in parallel.
6. Open the **Images** tab in the output, or download the dataset as JSON, CSV or Excel.

### Input example

```json
{
  "prompts": [
    "A watercolor painting of a red fox in a snowy birch forest at dawn",
    "Minimalist flat illustration of a lighthouse at dusk, pastel colors, lots of empty sky for a headline"
  ],
  "tier": "standard",
  "size": "1536x1024",
  "quality": "high",
  "imagesPerPrompt": 2,
  "outputFormat": "jpeg"
}
```

Editing with reference images:

```json
{
  "prompts": ["The mug from the first image on the wooden table from the second, soft morning light, product photo"],
  "model": "gpt-image-2.6-flare",
  "referenceImageUrls": ["https://example.com/mug.png", "https://example.com/table.jpg"],
  "size": "1024x1024"
}
```

### Input fields

| Field | What it does |
|---|---|
| `prompts` | One or more prompts (up to 1,000). |
| `tier` | `standard` ($0.06), `premium` ($0.08) or `pro` ($0.10). Picks the tier's default model. |
| `model` | Optional: a specific model. The price follows the model's tier. |
| `size` | `auto`, `1024x1024`, `1536x1024`, `1024x1536`, `1824x1024` (16:9), `1024x1824` (9:16), `2048x2048`, `2560x1440`, `1440x2560`, `3840x2160`, `2160x3840`. |
| `customSize` | Any `WIDTHxHEIGHT`: both sides multiples of 16, long side up to 3840 px and at most 3× the short side, 0.66 to 8.3 megapixels. |
| `quality` | `auto`, `low`, `medium`, `high`. GPT Image 2 only, same price. |
| `imagesPerPrompt` | 1 to 10 variations per prompt, each charged. |
| `referenceImageUrls` | Up to 16 public PNG, JPEG or WebP URLs (50 MB total). Turns each prompt into an edit. |
| `outputFormat` | `png` (default), `jpeg` or `webp`. |
| `transparentBackground` | Ask for a transparent background (PNG or WebP). |
| `keyValueStoreName` | Optional named key-value store to keep the images after the run's data retention period. |

### Output

One dataset row per image:

```json
{
  "status": "succeeded",
  "prompt": "A watercolor painting of a red fox in a snowy birch forest at dawn",
  "promptIndex": 0,
  "imageIndex": 0,
  "model": "gpt-image-2",
  "modelName": "GPT Image 2",
  "tier": "standard",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/image-0001-1-<run>.jpg",
  "size": "1536x1024",
  "format": "jpeg",
  "bytes": 532574,
  "chargedUsd": 0.06,
  "referenceImageUrls": [],
  "durationSec": 48,
  "error": null
}
```

A prompt that fails gets a row with `status: "failed"`, the reason in `error`, and `chargedUsd: 0`. The run's
`OUTPUT` record sums it up: images made, failures and the amount charged.

### Use cases

- **E-commerce product photos**: packshots on white, lifestyle scenes and seasonal variants from one product photo.
- **Marketing and social media**: ad creatives, blog hero images, thumbnails, 9:16 story and reel backgrounds.
- **Bulk content**: hundreds of illustrations from a spreadsheet of prompts, one run.
- **Design mock-ups**: logos, icons and stickers on a transparent background, posters with readable text.
- **Automation**: call it from the Apify API, Make, Zapier, n8n or an AI agent (MCP) and get image links back.

### Tips for good prompts

- Say the subject, setting, style, lighting and camera or medium: *"studio product photo, soft box light, 50 mm"*.
- Put text you want in the image in quotes: *a poster that says "Grand Opening"*.
- With reference images, say what to take from each: *"the logo from image 1 on the shirt in image 2"*.
- GPT Image models are strong at text in images and following detailed instructions; Nano Banana Pro is strong at photorealism and editing.

### Limits

- Images take about 30 seconds to 2 minutes each. Large batches run several images at once.
- Up to 10 images per prompt, 16 reference images, 1,000 prompts per run.
- Prompts are checked by the models' safety systems. Adult, violent or otherwise disallowed content is refused (and not charged).
- Reference image URLs are checked before anything is generated: a dead link or a non-image URL fails the run at once, naming the URL, and nothing is charged.
- Only use reference images you have the right to use.
- Images in the run's default store are deleted after your Apify plan's data retention period. Download them or use `keyValueStoreName`.

### FAQ

**Do I need an OpenAI or Google API key?** No. The model cost is included in the price per image.

**Does it work on the free Apify plan?** No. Image generation costs real money per image and free-plan runs are not
billed, so the Actor stops at the start with a message (nothing generated, nothing charged). Upgrade your Apify plan, or
use [Lovely Router](https://lovelyrouter.com/images?utm_source=apify\&utm_medium=actor\&utm_campaign=free-plan) directly.

**Am I charged for failed images?** No. Only images that were generated and saved are charged.

**Does a bigger size cost more?** No. Every size and quality costs the same.

**Can I use the images commercially?** You own what you create, subject to the model providers' usage policies.

**Can I use it from code?** Yes. Use the Apify API or client (`apify-client` for JavaScript or Python), or the Actor's MCP tool.

***

Powered by [Lovely Router](https://lovelyrouter.com/images?utm_source=apify\&utm_medium=actor): want these models
in your own code? Its Images API serves GPT Image 2, 2.5 and 2.6 through the OpenAI SDK at a flat price per image.

# Actor input Schema

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

One prompt per line or item. Each prompt makes "Images per prompt" images. Up to 1,000 prompts per run (bulk). Describe the subject, style, lighting and any text to render, e.g. "A watercolor painting of a red fox in a snowy birch forest at dawn".

## `tier` (type: `string`):

Picks the default model of the tier. Choose a specific model below to override it; the price follows the model's tier.

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

Leave on Auto to use the tier's default. All models generate and edit (with reference images).

## `size` (type: `string`):

Same price at every size. For another size use "Custom size".

## `customSize` (type: `string`):

WIDTHxHEIGHT, overrides Size. Both sides multiples of 16, long side at most 3840 px and at most 3× the short side, 655,360 to 8,294,400 pixels in total. Example: 1280x720 is too small; 1344x768 works.

## `quality` (type: `string`):

Rendering detail for GPT Image 2. Same price for every quality; higher takes longer. Other models ignore it.

## `imagesPerPrompt` (type: `integer`):

1 to 10 variations of each prompt. Each image is charged separately.

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

Up to 16 public image URLs (PNG, JPEG or WebP, 50 MB total). With reference images, every prompt is an edit: say what to take from each, e.g. "The mug from the first image on the wooden table from the second, morning light". Same price as a generation.

## `outputFormat` (type: `string`):

File format of the images. A 4K PNG is about 14 MB; JPEG and WebP are much smaller.

## `transparentBackground` (type: `boolean`):

Ask for a transparent background (PNG or WebP), e.g. for product cut-outs, logos and stickers. Best with GPT Image 2.

## `keyValueStoreName` (type: `string`):

Images go to the run's key-value store by default, which Apify deletes after your plan's data retention period. Give a name (e.g. "my-product-shots") to save them in a named key-value store that is kept until you delete it. Letters, digits and dashes only.

## Actor input object example

```json
{
  "prompts": [
    "A watercolor painting of a red fox in a snowy birch forest at dawn"
  ],
  "tier": "standard",
  "model": "auto",
  "size": "1024x1024",
  "quality": "auto",
  "imagesPerPrompt": 1,
  "outputFormat": "png",
  "transparentBackground": false
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

## `files` (type: `string`):

No description

# 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 watercolor painting of a red fox in a snowy birch forest at dawn"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("newpo/ai-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 watercolor painting of a red fox in a snowy birch forest at dawn"] }

# Run the Actor and wait for it to finish
run = client.actor("newpo/ai-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 watercolor painting of a red fox in a snowy birch forest at dawn"
  ]
}' |
apify call newpo/ai-image-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,newpo/ai-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/1Ec2BGWwrOtXPcque/builds/gzW4DzWir2hZheuCe/openapi.json
