# GPT-Image-2 - Prompt to Image AI Generator (`dev00/gpt-image-2-prompt-to-image`) Actor

Generate stunning, high-resolution AI images directly from text prompts using a secure, privacy-first GPT image generation module. Keywords: text to image, image generator, ai art, stable diffusion, midjourney, dall-e, image api, automated graphics, ai image creator.

- **URL**: https://apify.com/dev00/gpt-image-2-prompt-to-image.md
- **Developed by:** [dev00](https://apify.com/dev00) (community)
- **Categories:** AI, Agents, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$17.00 / 1,000 successful image generations

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Premium GPT-Powered AI Image Generator Module (Text-to-Image)

Generate stunning, high-resolution, photorealistic images from simple text prompts using a secure, privacy-first GPT image generation module. This Actor acts as a high-performance proxy gateway, securely bypassing complex challenges and fetching generated images instantly at a fraction of the cost of other providers.

---

### 🚀 API Overview

The **GPT-Powered AI Image Generator Module** is a developer-friendly tool designed to turn descriptions into high-quality digital artwork, photorealistic scenes, and creative diagrams. 

By utilizing our custom, lightweight gateway running on the edge, this Actor processes prompt-to-image requests in seconds without requiring any static tokens, API keys, or long-term cookies. 

#### What Problem Does This Solve?
1. **Expensive API Keys**: Standard image generators (like DALL-E 3 or Midjourney) charge high per-image rates. This module offers premium generations at a fraction of the price.
2. **Complex Authentication & Session Management**: No need to manage complex oauth flows, developer tokens, or session rotators. You pass a prompt and get the image.
3. **Slow Latency**: Edge-optimized challenge solving allows prompt resolution and stream parsing in under 15-20 seconds.

---

### 🛠️ Use Cases

*   **Game Development & Assets**: Generate placeholder textures, sprite bases, or spot-the-difference puzzle comparisons (e.g., side-by-side game screens).
*   **Content Creation**: Automatically create featured blog headers, social media graphics, and digital art illustrations.
*   **Prototyping & Mockups**: Quickly populate user interfaces, mobile apps, and websites with unique, non-placeholder images.
*   **Marketing Campaigns**: Produce high-concept ad variations based on test prompt matrices.

---

### 📥 Input Parameters

The Actor accepts a simple JSON configuration:

| Field | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| `prompt` | String | **Yes** | — | Detailed text description of the image to generate. |
| `format` | String | No | `'json'` | `'json'` returns base64 image data inside a JSON object. `'image'` returns the raw binary JPEG image data directly. |

#### Example Input JSON
```json
{
  "prompt": "A cozy, vibrant fantasy library with floating books and warm lighting, 3d render style",
  "format": "json"
}
````

***

### 📤 Output Structure

#### 1. JSON Format Output (`format: "json"`)

Returns a standard JSON response with the base64-encoded image:

**Status Code**: `200 OK`
**Content-Type**: `application/json`

```json
{
  "success": true,
  "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT..."
}
```

#### 2. Error Response Output

If a request fails (e.g., due to an empty prompt or network challenge timeout), the Actor returns a detailed error object:

**Status Code**: `500 Internal Server Error` or `400 Bad Request`
**Content-Type**: `application/json`

```json
{
  "success": false,
  "error": "The \"prompt\" parameter is required."
}
```

***

### 💰 Monetization & Pricing Model

This Actor operates under Apify's **Pay-Per-Event (PPE)** model:

- **Cost**: **$0.01 per successful image generation**
- **No Charge on Failure**: You are only billed when the image is successfully generated and delivered.
- **Compute Included**: This model absorbs all compute units (CU) costs, meaning you don't pay any extra platform resource charges.

***

### ❓ FAQ

#### Q: Do I need an OpenAI or GPT API key to use this?

No. The Actor uses a pre-authenticated edge gateway that solves environment challenges on the fly. You do not need to provide any API keys.

#### Q: What is the maximum resolution of the generated images?

Images are generated at standard high-resolution (typically 1024x1024 pixels or widescreen equivalents depending on prompt hints), optimized for web and app usage.

#### Q: Can I run multiple requests concurrently?

Yes, the backend handles parallel request scaling, allowing you to run bulk image generation pipelines simultaneously.

#### Q: Is commercial usage allowed for the generated images?

Yes, all generated images are free of copyrights and can be used for both personal and commercial projects.

***

### 🏷️ Search & Indexing Keywords

`text to image`, `image generator`, `ai art generator`, `gpt image creator`, `stable diffusion api`, `midjourney api alternative`, `base64 image api`, `royalty free ai images`, `dall-e 3 api alternative`, `ai image api`, `automated graphics`, `content generation api`

# Actor input Schema

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

Provide a descriptive text prompt for the image you want the AI to generate.

## `format` (type: `string`):

Select 'json' to get the Base64 image payload as JSON, or 'image' to download the binary JPEG directly.

## Actor input object example

```json
{
  "prompt": "A beautiful cute fluffy pink kitten playing with a ball of yarn, 3d render style, high resolution",
  "format": "json"
}
```

# Actor output Schema

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

No description

## `keyValueStoreResult` (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 = {
    "prompt": "A beautiful cute fluffy pink kitten playing with a ball of yarn, 3d render style, high resolution"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dev00/gpt-image-2-prompt-to-image").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": "A beautiful cute fluffy pink kitten playing with a ball of yarn, 3d render style, high resolution" }

# Run the Actor and wait for it to finish
run = client.actor("dev00/gpt-image-2-prompt-to-image").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": "A beautiful cute fluffy pink kitten playing with a ball of yarn, 3d render style, high resolution"
}' |
apify call dev00/gpt-image-2-prompt-to-image --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=dev00/gpt-image-2-prompt-to-image",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "GPT-Image-2 - Prompt to Image AI Generator",
        "description": "Generate stunning, high-resolution AI images directly from text prompts using a secure, privacy-first GPT image generation module. Keywords: text to image, image generator, ai art, stable diffusion, midjourney, dall-e, image api, automated graphics, ai image creator.",
        "version": "1.0",
        "x-build-id": "u1mpFmvUVvgc814EJ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/dev00~gpt-image-2-prompt-to-image/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-dev00-gpt-image-2-prompt-to-image",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/dev00~gpt-image-2-prompt-to-image/runs": {
            "post": {
                "operationId": "runs-sync-dev00-gpt-image-2-prompt-to-image",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/dev00~gpt-image-2-prompt-to-image/run-sync": {
            "post": {
                "operationId": "run-sync-dev00-gpt-image-2-prompt-to-image",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "prompt"
                ],
                "properties": {
                    "prompt": {
                        "title": "Prompt",
                        "type": "string",
                        "description": "Provide a descriptive text prompt for the image you want the AI to generate."
                    },
                    "format": {
                        "title": "Output Format",
                        "enum": [
                            "json",
                            "image"
                        ],
                        "type": "string",
                        "description": "Select 'json' to get the Base64 image payload as JSON, or 'image' to download the binary JPEG directly.",
                        "default": "json"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
