# GPT Image 2 Generator & Editor (`superlewis/gpt-image-2-generator-editor`) Actor

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

- **URL**: https://apify.com/superlewis/gpt-image-2-generator-editor.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 $32.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

## GPT Image 2 generator and editor

Generate and edit images with **GPT Image 2** from a list of prompts, in native **1K, 2K or 4K**. Work from text alone, or add up to 16 reference images to edit a photo or merge several images into one. Each image comes back as a URL in a dataset.

GPT Image 2 is good at following detailed instructions and at putting short text on the image, such as titles, labels and slogans. For the newer model with GIF and SVG output, see the [GPT Image 2.6 Actor](https://apify.com/superlewis/gpt-image-2-6-generator-images-gif-svg).

The Actor runs on the [apimodels.app GPT Image 2 API](https://apimodels.app/docs/gpt-image-2?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 | 1:1, 2:3, 3:2, 4:3, 3:4, 16:9, 9:16, 21:9, plus 4:5 and 5:4 at 1K, or Auto (follows the reference images) |
| Inputs | Text, or text plus up to 16 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.032 | $3.20 |
| 2K | $0.038 | $3.80 |
| 4K | $0.063 | $6.30 |

**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/gpt-image-2?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. With several images, refer to them as "image 1", "image 2" in the prompt.
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": ["Place the watch from image 1 on the marble desk in image 2, morning window light, keep the dial text sharp"],
  "resolution": "2K",
  "aspectRatio": "3:2",
  "referenceImageUrls": ["https://example.com/watch.jpg", "https://example.com/desk.jpg"]
}
```

### Output

One dataset item per image:

```json
{
  "ok": true,
  "imageUrl": "https://r2.apimodels.app/images/....png",
  "prompt": "Place the watch from image 1 on the marble desk in image 2, morning window light, keep the dial text sharp",
  "model": "gpt-image-2",
  "resolution": "2K",
  "aspectRatio": "3:2",
  "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, 10 MB each at most.
- Text-to-image with Auto gives a square image. Pick a ratio when the shape matters.
- 4:5 and 5:4 work at 1K only.
- 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.
- 2K and 4K images take longer than 1K; a 2K image usually takes one to two minutes.

### FAQ

**Is this the official OpenAI API?** No. It is an independent service by apimodels.app that provides access to the GPT Image 2 model.

**GPT Image 2 or GPT Image 2.6?** GPT Image 2.6 is the newer model and adds GIF and SVG output. GPT Image 2 remains a dependable choice for still images.

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

**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). With several reference images, refer to them as "image 1", "image 2" in the prompt.

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

Native output size. Larger sizes take longer.

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

Auto follows the reference images; without references it gives a square image. 4:5 and 5:4 are 1K only.

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

Up to 16 public image URLs (10 MB each at most) 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 minimalist poster for a jazz night, the words \"LATE SET\" in bold condensed type, saxophone silhouette, deep blue and brass tones"
  ],
  "resolution": "1K",
  "aspectRatio": "1:1"
}
```

# 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 minimalist poster for a jazz night, the words \"LATE SET\" in bold condensed type, saxophone silhouette, deep blue and brass tones"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("superlewis/gpt-image-2-generator-editor").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 minimalist poster for a jazz night, the words \"LATE SET\" in bold condensed type, saxophone silhouette, deep blue and brass tones"] }

# Run the Actor and wait for it to finish
run = client.actor("superlewis/gpt-image-2-generator-editor").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 minimalist poster for a jazz night, the words \\"LATE SET\\" in bold condensed type, saxophone silhouette, deep blue and brass tones"
  ]
}' |
apify call superlewis/gpt-image-2-generator-editor --silent --output-dataset

```

## MCP server setup

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

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/t7j5eJtBnPWySCZJM/builds/9KfeoVl4mK6tu7SzJ/openapi.json
