# AI Image Generator - Text to Image New (`akash9078/ai-image-generator-new`) Actor

Generate stunning AI images from text prompts. Create high-quality images using advanced AI models with support for multiple aspect ratios and customizable settings.

- **URL**: https://apify.com/akash9078/ai-image-generator-new.md
- **Developed by:** [Akash Kumar Naik](https://apify.com/akash9078) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

## AI Image Generator

Generate stunning AI images from text prompts using 12 advanced AI models. Create high-quality images with support for multiple aspect ratios and fast processing.

### What is AI Image Generator?

AI Image Generator transforms your creative ideas into visual masterpieces using state-of-the-art AI models. Choose from NVIDIA, OpenAI, Google, Wan, Qwen, Flux-2, Ideogram, Alibaba, and ByteDance models.

### Supported AI Models

| Model | Provider | Access | Supported Aspect Ratios |
|-------|----------|--------|------------------------|
| `nvidia-flux-2-klein` | NVIDIA | **Free** | 1:1, 16:9, 9:16, 4:3, 3:4, 21:9, 9:21, 3:2, 2:3, 2:1, 1:2 |
| `gpt-image-2` | OpenAI | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4 |
| `wan-2-7-image` | Wan | **Paid** | Fixed 2K resolution |
| `wan-2-7-image-pro` | Wan | **Paid** | Fixed 2K resolution |
| `qwen-text-to-image` | Qwen | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4 |
| `nano-banana-2` | Google | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4, 21:9, 9:21, 3:2, 2:3 + more |
| `flux-2-pro-text-to-image` | Flux-2 | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
| `ideogram-v3` | Ideogram | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4 |
| `z-image` | Alibaba | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4 |
| `nano-banana-pro` | Google | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 4:5, 5:4 |
| `flux-2-flex-text-to-image` | Flux-2 | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
| `seedream-3-0` | ByteDance | **Paid** | 1:1, 16:9, 9:16, 4:3, 3:4 |

**Free users** can only use `nvidia-flux-2-klein`. All other models require an Apify paid plan.

### Features

- **12 AI Models**: NVIDIA, OpenAI, Google, Wan, Qwen, Flux-2, Ideogram, Alibaba, ByteDance
- **Multiple Aspect Ratios**: From 1:1 to 21:9 and specialty ratios
- **Text-to-Image Generation**: Create images from text prompts
- **High-Quality Output**: Generate images up to 2K resolution
- **Fast Processing**: Powered by leading AI infrastructure
- **Pay Per Use**: Simple pricing per image generated

### Getting Started

Provide a text prompt, select an AI model, and optional aspect ratio to generate images.

### Input Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `model` | string | AI model to use (see supported models table) | `nvidia-flux-2-klein` |
| `prompt` | string | **Required.** Text description of the image you want to generate | - |
| `ratio` | string | Aspect ratio (varies by model - see supported ratios) | `1:1` |

#### Example Input (NVIDIA - Free Model)

```json
{
  "model": "nvidia-flux-2-klein",
  "prompt": "A beautiful sunset over mountains with vibrant orange and purple colors",
  "ratio": "16:9"
}
````

#### Example Input (Paid Models)

```json
{
  "model": "gpt-image-2",
  "prompt": "A majestic lion in golden savanna at sunset",
  "ratio": "1:1"
}
```

```json
{
  "model": "nano-banana-2",
  "prompt": "Professional product photography of a leather watch",
  "ratio": "4:3"
}
```

#### Example Output

```json
{
  "ok": true,
  "model": "nvidia-flux-2-klein",
  "prompt": "A majestic lion in golden savanna at sunset",
  "ratio": "1:1",
  "width": 1024,
  "height": 1024,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/...",
  "savedImageKey": "generated-image.png"
}
```

### Supported Aspect Ratios

| Ratio | Dimensions | Best For |
|-------|------------|----------|
| 1:1 | 1024x1024 | Social media posts, square images |
| 16:9 | 1184x672 | Landscape photos, videos, presentations |
| 9:16 | 672x1184 | Stories, vertical content, TikTok |
| 4:3 | 1184x880 | Classic photo format |
| 3:4 | 880x1184 | Portrait photos |
| 21:9 | 1568x672 | Ultra-wide panoramic, cinematic |
| 9:21 | 672x1568 | Ultra-tall content |
| 3:2 | 1248x832 | Standard photo print |
| 2:3 | 832x1248 | Portrait print |
| 2:1 | 1456x720 | Cinematic wide |
| 1:2 | 720x1456 | Tall portrait |

**Note**: Not all models support all ratios. The actor will automatically adjust to the nearest supported ratio if an unsupported ratio is selected.

### Environment Variables

| Variable | Description |
|----------|-------------|
| `NVIDIA_API_KEY` | API key for NVIDIA Flux 2 Klein model (required for nvidia-flux-2-klein) |
| `KIE_API_KEY` | API key for KIE marketplace models (required for paid models) |

**Note**: The Actor automatically detects your Apify plan. Free users can only use `nvidia-flux-2-klein`. Paid models are restricted to Apify paid plan users.

### Pricing

This Actor uses a **Pay Per Event** pricing model with a **24% profit margin**:

| Model | KIE Cost | Your Price |
|-------|----------|------------|
| `nvidia-flux-2-klein` | (user's key) | **Free** |
| `gpt-image-2` | $0.060 | **$0.11** |
| `wan-2-7-image` | $0.024 | **$0.043** |
| `wan-2-7-image-pro` | $0.060 | **$0.11** |
| `qwen-text-to-image` | $0.0125 | **$0.022** |
| `nano-banana-2` | $0.040 | **$0.072** |
| `flux-2-pro-text-to-image` | $0.025 | **$0.045** |
| `ideogram-v3` | $0.060 | **$0.11** |
| `z-image` | $0.004 | **$0.007** |
| `nano-banana-pro` | $0.090 | **$0.16** |
| `flux-2-flex-text-to-image` | $0.055 | **$0.11** |
| `seedream-3-0` | $0.030 | **$0.054** |

> **Note**: `nvidia-flux-2-klein` is free to use — users provide their own NVIDIA API key. All other models are powered by KIE API.

You only pay for successful image generations. No charges for failed runs.

### Output

Images are stored in the Actor's key-value store and can be accessed via:

- **imageUrl**: Public CDN URL to view/download the generated image (S3-backed)
- **savedImageKey**: Key for accessing the image in the key-value store

The `imageUrl` is a permanent, publicly accessible URL that can be shared directly.

***

**Keywords**: AI image generator, text to image, AI art, NVIDIA Flux, GPT Image, Wan, Qwen, Google Imagen, Flux-2, Ideogram, Z-Image, Seedream, image synthesis, Apify actor, AI automation, digital art, AI photography

# Actor input Schema

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

Select the AI model. Supported models: nvidia-flux-2-klein (free), gpt-image-2, wan-2-7-image, wan-2-7-image-pro, qwen-text-to-image, nano-banana-2, flux-2-pro-text-to-image, ideogram-v3/turbo/quality, z-image, nano-banana-pro, flux-2-flex-text-to-image, seedream-3-0

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

Describe the image you want to generate. Be specific about subjects, setting, style, lighting, and mood for best results.

## `ratio` (type: `string`):

Select image aspect ratio. Ratios vary by model: nvidia-flux-2-klein (11 ratios), gpt-image-2 (5), wan-2-7 (fixed 2K), qwen (5), nano-banana-2 (7), flux-2-pro/flex (7), ideogram/z-image (5), nano-banana-pro (9), seedream (5). Unsupported ratios will be rejected with guidance.

## Actor input object example

```json
{
  "model": "nvidia-flux-2-klein",
  "prompt": "A majestic lion in golden savanna at sunset",
  "ratio": "1:1"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `images` (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 = {
    "model": "nvidia-flux-2-klein",
    "prompt": "A majestic lion in golden savanna at sunset",
    "ratio": "1:1"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/ai-image-generator-new").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 = {
    "model": "nvidia-flux-2-klein",
    "prompt": "A majestic lion in golden savanna at sunset",
    "ratio": "1:1",
}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/ai-image-generator-new").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 '{
  "model": "nvidia-flux-2-klein",
  "prompt": "A majestic lion in golden savanna at sunset",
  "ratio": "1:1"
}' |
apify call akash9078/ai-image-generator-new --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/ai-image-generator-new",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Image Generator - Text to Image New",
        "description": "Generate stunning AI images from text prompts. Create high-quality images using advanced AI models with support for multiple aspect ratios and customizable settings.",
        "version": "0.1",
        "x-build-id": "snKx1geYfBo3a6hLC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~ai-image-generator-new/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-ai-image-generator-new",
                "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/akash9078~ai-image-generator-new/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-ai-image-generator-new",
                "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/akash9078~ai-image-generator-new/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-ai-image-generator-new",
                "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": {
                    "model": {
                        "title": "AI Model",
                        "enum": [
                            "nvidia-flux-2-klein",
                            "gpt-image-2",
                            "wan-2-7-image",
                            "wan-2-7-image-pro",
                            "qwen-text-to-image",
                            "nano-banana-2",
                            "flux-2-pro-text-to-image",
                            "ideogram-v3",
                            "ideogram-v3-turbo",
                            "ideogram-v3-quality",
                            "z-image",
                            "nano-banana-pro",
                            "flux-2-flex-text-to-image",
                            "seedream-3-0"
                        ],
                        "type": "string",
                        "description": "Select the AI model. Supported models: nvidia-flux-2-klein (free), gpt-image-2, wan-2-7-image, wan-2-7-image-pro, qwen-text-to-image, nano-banana-2, flux-2-pro-text-to-image, ideogram-v3/turbo/quality, z-image, nano-banana-pro, flux-2-flex-text-to-image, seedream-3-0",
                        "default": "nvidia-flux-2-klein"
                    },
                    "prompt": {
                        "title": "Prompt",
                        "minLength": 1,
                        "type": "string",
                        "description": "Describe the image you want to generate. Be specific about subjects, setting, style, lighting, and mood for best results."
                    },
                    "ratio": {
                        "title": "Aspect Ratio",
                        "enum": [
                            "1:1",
                            "16:9",
                            "9:16",
                            "4:3",
                            "3:4",
                            "21:9",
                            "9:21",
                            "3:2",
                            "2:3",
                            "2:1",
                            "1:2"
                        ],
                        "type": "string",
                        "description": "Select image aspect ratio. Ratios vary by model: nvidia-flux-2-klein (11 ratios), gpt-image-2 (5), wan-2-7 (fixed 2K), qwen (5), nano-banana-2 (7), flux-2-pro/flex (7), ideogram/z-image (5), nano-banana-pro (9), seedream (5). Unsupported ratios will be rejected with guidance.",
                        "default": "1:1"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
