# AI Image Generator – Text to Image, No API Key (`olliolli/text-to-image-generator`) Actor

Generate images from text prompts : batch prompts, 6 sizes, up to 4 variations, image-to-image with reference images, PNG/JPEG/WebP. No API key, pay per image.

- **URL**: https://apify.com/olliolli/text-to-image-generator.md
- **Developed by:** [Tom J](https://apify.com/olliolli) (community)
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 image generateds

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

## AI Image Generator – Text to Image, No API Key

Generate images from **text prompts** with **FLUX.2 \[klein]**, the compact image model from Black Forest Labs, running on Cloudflare Workers AI. Write one prompt or a hundred, pick a size, get up to 4 variations per prompt, and optionally give **reference images** for image-to-image. Download the results as **PNG, JPEG or WebP**. **No API key, no account with an AI provider**: you pay per image on Apify.

### How it works

1. **Write your prompts.** One prompt per line, for example *"A watercolor illustration of a lighthouse on a rocky coast at sunrise"*. English prompts give the best results.
2. **Pick the size and the number of images** per prompt. If you want, add up to 4 reference images, a seed or a guidance value.
3. **Run.** Every image is saved in the run's key-value store, and the dataset gets one row per image with a link to it. The **Images** view shows the pictures right in the table.

### Sizes

| Option | Pixels | Good for |
|---|---|---|
| Square HD (default) | 1024 × 1024 | social posts, product shots, avatars |
| Square | 768 × 768 | quick drafts |
| Landscape 4:3 | 1152 × 864 | blog images, slides |
| Landscape 16:9 | 1344 × 768 | banners, video thumbnails, headers |
| Portrait 3:4 | 864 × 1152 | posters, Pinterest |
| Portrait 9:16 | 768 × 1344 | stories, phone wallpapers |

Every size costs the same per image.

### Image-to-image (reference images)

Add up to **4 links** to images in **Reference images**: direct links to PNG, JPEG or WebP files (max 20 MB each), or share links from Google Drive, Dropbox or OneDrive set to "Anyone with the link". The model uses them as a reference for style, composition or subject, for example *"the same room, but in winter"* or *"this product on a marble table"*.

- The reference images are used for **every prompt** in the run.
- They are scaled down to fit inside 511 × 511 pixels before they are sent (a limit of the service); the generated image still has the size you picked.
- Links to pages on social media or other platforms are not supported.
- If a reference image cannot be used, the run stops before anything is generated, and **nothing is charged**.
- Only use images you have the right to use.

### Seeds and variations

- **Images per prompt** (1–4) gives you several variations of the same prompt. Each one is a separate image and is charged separately.
- Without a seed, every image gets a random one. The seed is in every row, so you can repeat a result you like.
- With a seed, image 1 uses that seed, image 2 uses seed + 1, and so on. The same prompt, size, reference images and seed should give the same image again.

### Pricing

Pay per event: **$0.004 per generated image**, on every Apify plan.

| You generate | You pay |
|---|---|
| 1 image | $0.004 |
| 10 prompts × 1 image | $0.04 |
| 25 prompts × 4 variations = 100 images | $0.40 |
| 100 prompts × 4 variations = 400 images | $1.60 |

#### What you are not charged for

- Prompts that are refused under the acceptable-use rules below
- Images that fail (for example when the image service has an error, or does not answer in time)
- Prompts whose safety check could not be completed
- Images skipped because of a limit: your **maximum cost per run**, **Maximum images per run**, or the daily capacity of this actor
- Runs that stop because of a wrong input or a reference image that cannot be used

Before an image is generated, the actor checks that it fits within your **maximum cost per run**. If it doesn't, the image is skipped and you pay nothing for it.

**Apify free plan:** at most **4 images per run** and **10 images per day** (enough to try it out). Images beyond that are skipped and not charged. On a paid Apify plan these limits do not apply.

### Input example

```json
{
  "prompts": [
    "A watercolor illustration of a lighthouse on a rocky coast at sunrise",
    "Flat vector icon of a coffee cup, pastel colors, white background"
  ],
  "imageSize": "landscape_16_9",
  "numImages": 2,
  "seed": 1234,
  "outputFormat": "webp",
  "maxImages": 20
}
```

### Output

One row per image:

```json
{
  "prompt": "A watercolor illustration of a lighthouse on a rocky coast at sunrise",
  "promptNumber": 1,
  "imageNumber": 2,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<store>/records/001-2.webp",
  "width": 1344,
  "height": 768,
  "seed": 1235,
  "format": "webp",
  "referenceImages": 0,
  "status": "ok",
  "statusMessage": "Generated."
}
```

| status | Meaning | Charged |
|---|---|---|
| `ok` | The image was generated and saved | yes |
| `refused_content` | The prompt was refused under the acceptable-use rules | no |
| `failed` | Something went wrong (see `statusMessage`) | no |
| `not_processed_limit` | Skipped because of a limit (your budget, `maxImages`, free plan) | no |
| `quota_exhausted` | The daily capacity of this actor is used up; try again after 00:00 UTC | no |

The image files are named `<prompt number>-<image number>.<png|jpg|webp>`, for example `003-1.png`. The run summary (record `OUTPUT`) lists how many images were generated, refused, failed and charged.

### Acceptable use

To keep this actor safe, every prompt is checked before an image is generated: first by a fixed word filter, then by the safety model Llama Guard 3. A prompt that may break these rules is refused. **Refused prompts cost nothing.** Do not use this actor for:

- sexual or sexually suggestive content of any kind;
- anything involving minors in a sexual, violent or otherwise harmful way;
- images of real people without their consent, including public figures, and anything that could defame or mislead about a real person;
- famous characters, logos, brands or other protected works of others;
- hate, harassment, violence, weapons of mass harm or self-harm.

The safety check is automatic and can be wrong in both directions. You remain responsible for the prompts you send, for the reference images you use, and for how you use the results.

### Privacy

- Your prompts and reference images are sent to **Cloudflare Workers AI** to check and generate the images. They are not used for anything else by this actor.
- The prompts are not written to the run log.
- Nothing is kept after the run, except what is in your own run storage (the dataset and key-value store), which follows your Apify data retention settings.

### Terms for the generated images

The images are made with FLUX.2 \[klein] by Black Forest Labs, run by Cloudflare. **You must follow Black Forest Labs' terms** ([bfl.ai/legal/terms-of-service](https://bfl.ai/legal/terms-of-service)) and Cloudflare's terms for Workers AI. Check those terms yourself before you use the images, in particular for commercial use. This actor is not affiliated with or endorsed by Black Forest Labs or Cloudflare.

### Limits

- Up to **100 prompts** per run, each up to 2,000 characters; up to 4 images per prompt; at most 400 images per run (`maxImages`, default 20).
- Up to 3 images are generated at the same time.
- Text inside images (lettering, logos) is often imperfect with compact models.
- During busy times the service can be slower; an image that takes longer than 3 minutes is marked `failed` and not charged.

### FAQ

**Do I need an API key or an account with an AI provider?** No. The actor uses its owner's Cloudflare account; you only pay the price per image on Apify.

**Why was my prompt refused?** The safety check found that it may conflict with the acceptable-use rules. Refused prompts are free. Rephrase the prompt if you believe it was a mistake.

**Can I use the API?** Yes: start the actor through the Apify API with the input above and read the dataset items; `imageUrl` points to the image file.

# Actor input Schema

## `prompts` (type: `array`):

One prompt per line: describe the image you want, in English for the best results (up to 2000 characters each, at most 100 prompts). Prompts that break the acceptable-use rules in the README are refused and not charged.

## `imageSize` (type: `string`):

Width × height in pixels. Larger images cost the same per image but take a little longer.

## `numImages` (type: `integer`):

How many variations to generate for every prompt (each one is a separate, charged image).

## `outputFormat` (type: `string`):

File format of the images: PNG (lossless), JPEG (smaller, no transparency) or WebP (smallest).

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

Optional: up to 4 direct links to images (PNG, JPEG, WebP, max 20 MB each) the model should use as a reference for style, composition or subject; they are used for every prompt. Cloud-drive share links work; links to social-media pages do not. Only use images you have the right to use, and no photos of real people without their consent.

## `seed` (type: `integer`):

Optional number (0 to 2147483647) to make results repeatable: the same prompt, size and seed give the same image. With several images per prompt, image k uses seed + k. Leave empty for a random seed; the seed used is in every row.

## `guidance` (type: `number`):

Optional: how strictly the image follows the prompt (0-20). Leave empty for the model's default.

## `maxImages` (type: `integer`):

Safety limit: the run stops generating after this many images (the rest is marked not_processed_limit and not charged). Your maximum cost per run in Apify is respected as well.

## Actor input object example

```json
{
  "prompts": [
    "A watercolor illustration of a lighthouse on a rocky coast at sunrise"
  ],
  "imageSize": "square",
  "numImages": 1,
  "outputFormat": "png",
  "maxImages": 20
}
```

# Actor output Schema

## `images` (type: `string`):

One row per image: prompt, image link, size, seed, format, status.

## `files` (type: `string`):

The image files of this run in the key-value store.

## `summary` (type: `string`):

Images generated, refused, failed and charged, estimated Cloudflare neurons, stop reason (OUTPUT).

# 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 watercolor illustration of a lighthouse on a rocky coast at sunrise"
    ],
    "imageSize": "square",
    "numImages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("olliolli/text-to-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 = {
    "prompts": ["A watercolor illustration of a lighthouse on a rocky coast at sunrise"],
    "imageSize": "square",
    "numImages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("olliolli/text-to-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 '{
  "prompts": [
    "A watercolor illustration of a lighthouse on a rocky coast at sunrise"
  ],
  "imageSize": "square",
  "numImages": 1
}' |
apify call olliolli/text-to-image-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,olliolli/text-to-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/IfefKpCM3Q1kZd2QU/builds/yuWJ1OHb5mmhnyaGQ/openapi.json
