# GPT Image API: GPT Image 2, 2.5 & 2.6 Generator (`newpo/gpt-image-api`) Actor

GPT Image API for OpenAI GPT Image 2, 2.5 and 2.6: text-to-image and image editing with reference images, up to 4K, real-time Standby API or bulk runs. Flat $0.04 per image at any size, failed images are free, no OpenAI key needed.

- **URL**: https://apify.com/newpo/gpt-image-api.md
- **Developed by:** [newpo](https://apify.com/newpo) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% 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

## GPT Image API: generate and edit images with GPT Image 2, 2.5 and 2.6

**GPT Image API** is a focused text-to-image and image-editing API for OpenAI's **GPT Image** models: **GPT Image 2**, **GPT Image 2.5** (Flare and Sunburst) and **GPT Image 2.6** (Flare and Sunburst). Call it as a **real-time REST endpoint** (Apify Standby) and get an image link back in JSON, or run it in bulk with up to 1,000 prompts.

No OpenAI account or API key, no subscription: you pay **a flat $0.04 per image at any size up to 4K**, and **failed images are free**. Need Nano Banana (Gemini) or other model families too? Use the sister Actor [AI Image Generator](https://apify.com/newpo/ai-image-generator).

### How much does a GPT Image API call cost?

One price: **$0.04 per image**, for every model, every size (1024×1024 up to 3840×2160) and for edits as well as generations. You are charged only for images that were generated and saved.

| Job | Cost |
|---|---|
| 1 product shot, 1024×1024 | $0.04 |
| 50 blog hero images, 1536×1024 | $2.00 |
| 20 prompts × 4 variations, 4K | $3.20 |
| 10 edits with 3 reference images each | $0.40 |

Normal runs add Apify's tiny start fee ($0.00005); Standby API requests are charged per image only. 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 does the price compare?

Other GPT Image actors on the Apify Store that need no API key of your own, with their per-image price at paid-plan rates (prices checked November 2026, from public Store listings; they vary by size, quality and plan):

| Model family | Other Store actors, all-in per image | This Actor, any size |
|---|---|---|
| GPT Image 2 / 2.5 | $0.017 to $0.13 | **$0.04** |
| GPT Image 2.6 | $0.013 (1K, low quality only) to $0.10 | **$0.04** |

"All-in" counts any model usage some actors bill separately through your Apify account on top of their own fee. The price here is a fraction of what some of the most-used image actors charge ($0.13 and up), and it does not change with size; a few smaller actors list lower prices for some sizes or quality settings.

### Use as a real-time GPT Image API (Standby)

Besides normal runs, the Actor runs as an **always-ready HTTP API** (Apify Standby). Send one prompt, wait for the image (usually 20 to 60 seconds), get JSON with the image link back. Authenticate with your Apify API token. Base URL: `https://newpo--gpt-image-api.apify.actor`

`GET` or `POST /generate`, **one prompt per request**:

| Parameter | Meaning |
|---|---|
| `prompt` | Required. What to draw (up to 8,000 characters). |
| `model` | `gpt-image-2` (default), `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst`, `gpt-image-2.6-flare` or `gpt-image-2.6-sunburst`. |
| `size` / `customSize` | Default `1024x1024`; up to 3840x2160. Both sides multiples of 16, long side at most 3× the short side, 0.66 to 8.3 megapixels. |
| `imagesPerPrompt` | 1 to 4 (default 1). |
| `referenceImageUrls` | Up to 16 public image URLs (array in a POST body, comma separated in a GET) to edit or combine pictures. |
| `outputFormat` | `png` (default), `jpeg` or `webp`. |
| `response` | `url` (default) or `b64_json` to also get the image data in the response. |

**Price:** $0.04 per image delivered. A request that fails returns an error and costs nothing.

**curl**

```bash
curl -H "Authorization: Bearer $APIFY_TOKEN" \
  "https://newpo--gpt-image-api.apify.actor/generate?prompt=a+red+fox+in+a+snowy+birch+forest,+watercolor&size=1536x1024&outputFormat=jpeg"
```

**Python**

```python
import requests

r = requests.post(
    "https://newpo--gpt-image-api.apify.actor/generate",
    headers={"Authorization": f"Bearer {APIFY_TOKEN}"},
    json={"prompt": "Studio product photo of a ceramic mug, soft window light", "model": "gpt-image-2", "size": "1024x1024"},
    timeout=300,
)
print(r.json()["images"][0]["url"])
```

**JavaScript (Node 18+)**

```js
const res = await fetch('https://newpo--gpt-image-api.apify.actor/generate', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ prompt: 'Minimalist lighthouse illustration at dusk', model: 'gpt-image-2.6-flare', size: '1824x1024' }),
});
const { images } = await res.json();
console.log(images[0].url);
```

Response:

```json
{
  "prompt": "a red fox in a snowy birch forest, watercolor",
  "model": "gpt-image-2.6-flare", "modelName": "GPT Image 2.6 Flare",
  "count": 1,
  "images": [{ "url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/image-....jpg?signature=...", "size": "1254x1254", "format": "jpeg", "bytes": 518212 }],
  "chargedUsd": 0.04, "pricePerImageUsd": 0.04, "durationSec": 28
}
```

Notes: set your HTTP timeout to at least 5 minutes (requests are cut off after 5 minutes; a request that cannot finish in time returns an error and is not charged). Standby is meant for one prompt at a time; for hundreds of prompts use a normal run, which processes prompts in parallel. The first request after a quiet period starts the container, which adds a few seconds. The `size` in the response is the real size of the file: GPT Image sometimes renders slightly larger than asked (for example 1254×1254 for a 1024×1024 request) at the same aspect ratio. Image links are kept in the Actor's storage for your plan's data retention period, so download what you need to keep.

### How to generate GPT Image images in bulk

1. Enter your prompts, one per line.
2. Pick a GPT Image model (GPT Image 2 is the default).
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"
  ],
  "model": "gpt-image-2",
  "size": "1536x1024",
  "imagesPerPrompt": 2,
  "outputFormat": "jpeg"
}
```

#### Input fields

| Field | What it does |
|---|---|
| `prompts` | One or more prompts (up to 1,000). |
| `model` | One of the five GPT Image models. Same price for all. |
| `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. |
| `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`. |
| `keyValueStoreName` | Optional named key-value store to keep the images after the run's data retention period. |

### How to edit images with GPT Image

Add public image URLs in `referenceImageUrls` and say what to take from each:

```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"
}
```

Editing costs the same $0.04. Reference 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.

### What do you get back?

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",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/image-0001-1-<run>.jpg",
  "size": "1536x1024",
  "format": "jpeg",
  "bytes": 532574,
  "chargedUsd": 0.04,
  "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.

### Which GPT Image models can I use?

| Model id | Notes |
|---|---|
| `gpt-image-2` | The default. Requests can be served by GPT Image 2 or 2.5 at the same price. |
| `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst` | GPT Image 2.5. |
| `gpt-image-2.6-flare`, `gpt-image-2.6-sunburst` | GPT Image 2.6. |

All five accept reference images. Only GPT Image models are served here: no other vendors' models.

### What can you use it for?

- **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 backgrounds.
- **Bulk content**: hundreds of illustrations from a spreadsheet of prompts, one run.
- **Posters, logos and text in images**: GPT Image models follow detailed instructions and render text well.
- **Automation**: call it from the Apify API, Make, Zapier, n8n or an AI agent and get image links back.

### How to write good GPT Image 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"*.

### 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 (Standby: 1 prompt, up to 4 images).
- Prompts are checked by the models' safety systems. Adult, violent or otherwise disallowed content is refused (and not 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`.

### How to use it from Python, Node.js, Make, Zapier or n8n

```python
from apify_client import ApifyClient

client = ApifyClient(APIFY_TOKEN)
run = client.actor("newpo/gpt-image-api").call(run_input={"prompts": ["A watercolor fox", "A neon city at night"], "model": "gpt-image-2", "outputFormat": "jpeg"})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["status"], row["imageUrl"])
```

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('newpo/gpt-image-api').call({ prompts: ['A watercolor fox'], size: '1536x1024' });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

In **Make**, **Zapier** and **n8n** use the Apify app's *Run Actor* action with the input above, or an *HTTP* module against `/generate` with your token in the `Authorization` header.

### FAQ

**How do I call GPT Image through an API without an OpenAI key?** Send `GET` or `POST /generate` to the Standby URL above with a `prompt` and your Apify token; the JSON response contains the image link. The model cost is included in the price.

**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 up to 4K costs $0.04.

**What is the difference between GPT Image 2, 2.5 and 2.6?** They are successive GPT Image versions with the same inputs and the same price here. Generate one prompt with several models and compare.

**Can it edit images?** Yes. Pass reference image URLs and describe the change. Editing costs the same as generating.

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

**Is there a free trial?** New Apify accounts include free monthly platform credit that you can spend on this Actor.

**How long does an image take?** Usually 20 seconds to 2 minutes.

**Do you also offer Nano Banana or other models?** Not here: this Actor serves GPT Image models only. [AI Image Generator](https://apify.com/newpo/ai-image-generator) offers Nano Banana Pro and Nano Banana 2 as well.

***

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 models 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. Describe the subject, style, lighting and any text to render, e.g. "A neon sign that reads OPEN in a rainy street at night".

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

All models generate and edit (with reference images) and cost the same: $0.04 per image at any size.

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

Same price at every size ($0.04). 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.

## `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.

## `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 product photo of a ceramic coffee mug on a walnut desk, soft morning light, shallow depth of field"
  ],
  "model": "gpt-image-2",
  "size": "1024x1024",
  "imagesPerPrompt": 1,
  "outputFormat": "png"
}
```

# 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 product photo of a ceramic coffee mug on a walnut desk, soft morning light, shallow depth of field"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("newpo/gpt-image-api").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 product photo of a ceramic coffee mug on a walnut desk, soft morning light, shallow depth of field"] }

# Run the Actor and wait for it to finish
run = client.actor("newpo/gpt-image-api").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 product photo of a ceramic coffee mug on a walnut desk, soft morning light, shallow depth of field"
  ]
}' |
apify call newpo/gpt-image-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,newpo/gpt-image-api"
        }
    }
}
```

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/0KToUgwaMUZHDfcCa/builds/ki7IANuJgj6uG7EBK/openapi.json
