# FLUX Image Generator (FLUX.2, Kontext, Schnell, Pro) (`pnda/flux-image-generator`) Actor

FLUX image generator: FLUX.2 Pro, FLUX.2 Klein, FLUX 1.1 Pro, Dev, Schnell and FLUX Kontext Pro / Max to edit images with a sentence. Prompt optimization + AI quality score (pass / review / fail) to automate ads and product shots. No API key, from $0.02 per image.

- **URL**: https://apify.com/pnda/flux-image-generator.md
- **Developed by:** [PNDA](https://apify.com/pnda) (community)
- **Categories:** AI, Social media, E-commerce
- **Features:** Limited permissions
- **Stats:** 6 total users, 5 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 image (lite)s

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

## FLUX Image Generator (FLUX.2, Kontext, Schnell, Pro)

**FLUX image generator**: Black Forest Labs **FLUX.2 Pro**, **FLUX.2 Klein**, **FLUX 1.1 Pro**, **Dev**, **Schnell** and **FLUX Kontext Pro / Max** for image editing, from **$0.02 per image**.

- 🎨 Text to image with every FLUX model.
- ✏️ FLUX Kontext: edit an image with a sentence.
- ✨ Optional prompt optimization ($0.015) with a use case (product, ads, social...).
- 🔑 **No API key**: no OpenAI, Google or ByteDance account needed.
- 🆓 **Works with a free Apify account too**: 1 generation per month (one image) with FLUX.1 Schnell, billed at the normal price ($0.02). Every model and option on paid Apify plans.
- 🚫 **Sexually explicit content is not allowed.** Such prompts stop at once, at no cost.
- 🎯 **Quality score for automation** (optional, $0.01 per output): an AI checks every image for weird or broken details and for its match with your prompt, so you can publish without checking by hand.
- 💸 **Pay only for successful outputs.** Failures are never charged.

Works from the Apify Console, the API, the JavaScript / Python clients, **n8n, Make, Zapier** and **AI agents / MCP**.

### 🎯 Quality score: run stories, ads and UGC on autopilot

Turn on `qualityScore` and every delivered image is checked by a multimodal AI before it reaches you, in two steps:

1. **Coherence**: nothing weird or broken (hands and fingers, faces, objects merging or appearing from nowhere, garbled text, illogical actions).
2. **Prompt match**: the subject, product, setting, action and any quoted text of **your original prompt** are there (not the optimized prompt), and nothing was added that you did not ask for (text, logo, object, product color).

Each issue is graded like an art director looking at the image at normal size: **critical** (unusable: wrong product, something appearing from nowhere), **major** (visible at first glance) or **minor** (only seen when zooming in, such as watch hands or buckles).

Each row then has `qualityScore` (0-100), `coherenceScore`, `promptMatchScore`, `issues` (short list in English) and `verdict`:

| Verdict | Rule | What to do |
|---|---|---|
| `pass` | no critical or major issue, quality >= 75 | publish automatically |
| `review` | a major issue (first-glance defect, unrequested text...) | a quick human look |
| `fail` | a critical issue or quality < 50 | discard or regenerate |

No more checking every image by hand: in **n8n, Make, Zapier** or your own code, publish the `pass` rows of your daily stories, ads or product visuals and regenerate the `fail` ones. **$0.01 per scored image**; if the checker is unavailable the image is delivered without a score and nothing extra is charged.

### 💡 Who is it for?

- E-commerce and marketing teams
- Content and SEO teams: covers, OG images
- Developers: one FLUX API

### ⚙️ How it works

1. You send a **prompt**, plus an image URL if you want to edit a picture, and pick a model.
2. The Actor generates each output and waits for the result (no task id to poll).
3. Each file is **copied to your Apify key-value store**, so the link does not expire after an hour.
4. One dataset row per output: URL, model, options.

### 💰 Pricing

Pay per event, one event per successful output, no start fee. Paid Apify plans: every model below. **Works with a free Apify account too**: 1 generation per month (one image) with FLUX.1 Schnell, billed at the normal price ($0.02).

| Model | Option | Event | Price per output |
|---|---|---|---|
| FLUX.1 Schnell | — | `image-lite` | $0.02 |
| FLUX.2 Klein 4B | — | `image-lite` | $0.02 |
| FLUX.1 Dev | — | `image-standard` | $0.13 |
| FLUX.2 Pro | — | `image-pro` | $0.17 |
| FLUX 1.1 Pro | — | `image-pro` | $0.17 |
| FLUX.1 Kontext Pro (editing) | — | `image-pro` | $0.17 |
| FLUX.1 Kontext Max (editing) | — | `image-premium` | $0.40 |

- A failed output is **not charged**. If nothing could be produced, nothing is charged.
- **Prompt optimization** (optional, `optimizePrompt` or a use case): **$0.015 per optimized prompt** (event `prompt-optimization`), charged once with the first delivered output that uses it. Not charged if the prompt writer is unavailable or nothing is delivered. Not available on the free Apify plan.
- **Quality score** (optional, `qualityScore`): **$0.01 per scored output** (event `quality-score`). Not charged if the checker is unavailable or the output failed. Not available on the free Apify plan.
- Set a **maximum cost per run**: the Actor stops *before* generating an output your budget would not cover.

### 📥 Input

| Field | Type | Description |
|---|---|---|
| `prompt` | string | Text description of the image to generate, or the edit to make to the source image. |
| `model` | string | Which AI model to use. Each option is billed at its own price, see the Pricing section of the README. Free Apify plan: 1 generation per month (one image) with FLUX.1 Schnell, billed at the normal price ($0.02); other models and options are replaced by it. |
| `imageUrl` | string | Public URL of an image to edit (or to upscale). Leave empty for text-to-image. |
| `optimizePrompt` | boolean | An AI prompt writer rewrites your idea into a detailed image prompt for the selected model (subject, composition, light, style), keeping every detail you gave and any text in quotes. $0.015 per optimized prompt (event "prompt-optimization"), charged once with the first delivered output that uses it; nothing extra if the writer is unavailable. The prompt actually used is in the output ("prompt", with your text in "originalPrompt"). If the writer is unavailable, your own prompt is used. |
| `preset` | string | Style brief for the prompt optimization: product (e-commerce), ads, social post, UGC, story, cinematic, portrait. Picking a use case turns "Optimize my prompt" on. |
| `qualityScore` | boolean | A multimodal AI looks at each image: coherence (hands, faces, objects, text, illogical details) and match with your original prompt. Adds qualityScore, coherenceScore, promptMatchScore (0-100), issues and verdict (pass / review / fail) to each row, so you can publish only the "pass" ones automatically. $0.01 per scored output (event "quality-score"); nothing extra if the checker is unavailable. |
| `aspectRatio` | string | Output aspect ratio. "auto" keeps the model default (for edits: the source image ratio). Not every model supports every ratio; an unsupported ratio stops the run before anything is charged. |
| `numberOfVariants` | integer | How many separate outputs to generate (1 to 10). Each successful one is billed; failures are free. |
| `includeFailedVariants` | boolean | Also write failed outputs (with the reason) to the dataset. Failed outputs are never billed. |

#### Example: Cheapest: FLUX Schnell

```json
{
  "prompt": "beige linen tablecloth on a garden table",
  "model": "black-forest-labs/flux-schnell",
  "aspectRatio": "1:1",
  "preset": "product"
}
```

#### Example: Edit a photo (FLUX Kontext Pro)

```json
{
  "prompt": "Replace the background with a marble kitchen",
  "imageUrl": "https://example.com/product.jpg",
  "model": "black-forest-labs/flux-kontext-pro"
}
```

### 📤 Output

One dataset row per output:

```json
{
  "model": "black-forest-labs/flux-schnell",
  "mode": "text-to-image",
  "index": 1,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/image-1",
  "contentType": "image/png",
  "chargedEvent": "image-lite",
  "chargedUnits": 1,
  "success": true
}
```

Export the dataset as **JSON, CSV, Excel or HTML**, or read it from the API.

### 🧠 Models

- **FLUX.1 Schnell** (`black-forest-labs/flux-schnell`): 11 aspect ratios.
- **FLUX.2 Klein 4B** (`black-forest-labs/flux-2-klein-4b`): 11 aspect ratios.
- **FLUX.1 Dev** (`black-forest-labs/flux-dev`): optional img2img image, 11 aspect ratios.
- **FLUX.2 Pro** (`black-forest-labs/flux-2-pro`): 9 aspect ratios.
- **FLUX 1.1 Pro** (`black-forest-labs/flux-1.1-pro`): 9 aspect ratios.
- **FLUX.1 Kontext Pro (editing)** (`black-forest-labs/flux-kontext-pro`): optional edit image, 13 aspect ratios.
- **FLUX.1 Kontext Max (editing)** (`black-forest-labs/flux-kontext-max`): optional edit image, 13 aspect ratios.

### 🛟 Errors and reliability

- Invalid options (unsupported ratio, duration or resolution for the chosen model) stop the run **before** anything is generated or charged, with a message listing the supported values.
- If the AI provider is temporarily unavailable, the run stops right away (no time burned on the remaining outputs), **nothing is charged**, and the dataset contains one row with `success: false`, `status: "service-unavailable"` and a clear message. Retry a bit later.
- Runs whose maximum cost per run is too low for one output stop at once with an explanatory row (`status: "budget-too-low"`), at no cost.
- Free Apify plan: once the 1 generation of the month is used, or when the daily free-plan capacity is reached, runs stop at once with `status: "free-plan-limit"`, at no cost. If free-plan runs are temporarily unavailable, the row says `status: "paid-plan-required"`, also at no cost.
- If one output is refused (safety filter, unreadable source image), the others still run.

### ❓ FAQ

**Which FLUX should I pick?**

Schnell or FLUX.2 Klein for cheap drafts, FLUX.2 Pro or 1.1 Pro for quality, Kontext Pro / Max to edit an existing image.

**Do I need an API key (OpenAI, Google...)?**

No. Your Apify account is enough: no key, no subscription, no quota to manage.

**Can I use it on the free Apify plan?**

Yes. Works with a free Apify account too: 1 generation per month (one image) with FLUX.1 Schnell, billed at the normal price ($0.02), from your free monthly Apify credit. On a free plan only FLUX.1 Schnell is used, one output per run: if you pick another model or option, the run uses it instead and says so in the output row (`notice`). Once the monthly generation is used (or when the daily free-plan capacity is reached), runs stop at once with `status: "free-plan-limit"`, at no cost. Paid Apify plans get every model and option, without this limit.

**Am I charged when a generation fails?**

No. You pay only for outputs that are delivered. Invalid inputs are rejected before any generation starts.

**How do I cap my spending?**

Set **Maximum cost per run** in the run options. The Actor stops before generating an output your budget would not cover.

**How long are files kept?**

Outputs are copied to the run key-value store and follow your Apify data retention. Download them or copy them to your own storage for long-term use.

**Can I call it from code, n8n, Make, Zapier or an AI agent?**

Yes. Use the "Run Actor synchronously and get dataset items" API endpoint, the Apify clients, the integrations, or the Apify MCP server.

**Who owns the generated content?**

Use of generated content is subject to the terms of each model provider. Do not submit images you do not have the right to use.

### ▶️ Start now

Pick a model, type a prompt, click **Start**.

# Actor input Schema

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

Text description of the image to generate, or the edit to make to the source image.

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

Which AI model to use. Each option is billed at its own price, see the Pricing section of the README. Free Apify plan: 1 generation per month (one image) with FLUX.1 Schnell, billed at the normal price ($0.02); other models and options are replaced by it.

## `imageUrl` (type: `string`):

Public URL of an image to edit (or to upscale). Leave empty for text-to-image.

## `optimizePrompt` (type: `boolean`):

An AI prompt writer rewrites your idea into a detailed image prompt for the selected model (subject, composition, light, style), keeping every detail you gave and any text in quotes. $0.015 per optimized prompt (event "prompt-optimization"), charged once with the first delivered output that uses it; nothing extra if the writer is unavailable. The prompt actually used is in the output ("prompt", with your text in "originalPrompt"). If the writer is unavailable, your own prompt is used.

## `preset` (type: `string`):

Style brief for the prompt optimization: product (e-commerce), ads, social post, UGC, story, cinematic, portrait. Picking a use case turns "Optimize my prompt" on.

## `qualityScore` (type: `boolean`):

A multimodal AI looks at each image: coherence (hands, faces, objects, text, illogical details) and match with your original prompt. Adds qualityScore, coherenceScore, promptMatchScore (0-100), issues and verdict (pass / review / fail) to each row, so you can publish only the "pass" ones automatically. $0.01 per scored output (event "quality-score"); nothing extra if the checker is unavailable.

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

Output aspect ratio. "auto" keeps the model default (for edits: the source image ratio). Not every model supports every ratio; an unsupported ratio stops the run before anything is charged.

## `numberOfVariants` (type: `integer`):

How many separate outputs to generate (1 to 10). Each successful one is billed; failures are free.

## `includeFailedVariants` (type: `boolean`):

Also write failed outputs (with the reason) to the dataset. Failed outputs are never billed.

## Actor input object example

```json
{
  "prompt": "beige linen tablecloth on a garden table",
  "model": "black-forest-labs/flux-schnell",
  "optimizePrompt": false,
  "preset": "none",
  "qualityScore": false,
  "aspectRatio": "auto",
  "numberOfVariants": 1,
  "includeFailedVariants": false
}
```

# Actor output Schema

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

All generated records (JSON, CSV, Excel).

# 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": "beige linen tablecloth on a garden table",
    "model": "black-forest-labs/flux-schnell",
    "numberOfVariants": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pnda/flux-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 = {
    "prompt": "beige linen tablecloth on a garden table",
    "model": "black-forest-labs/flux-schnell",
    "numberOfVariants": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("pnda/flux-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 '{
  "prompt": "beige linen tablecloth on a garden table",
  "model": "black-forest-labs/flux-schnell",
  "numberOfVariants": 1
}' |
apify call pnda/flux-image-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pnda/flux-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/ECuij1r3ehZdgRUiy/builds/yNxz6RSEN3zJpPbrW/openapi.json
