# AI Image Generation — Text to Image API (`vivid_astronaut/image-generation`) Actor

Generate images from text prompts: photos, illustrations, and artwork with multiple styles and quality options. Input a prompt, get image files back — ready for content creation, marketing assets, and creative automation.

- **URL**: https://apify.com/vivid_astronaut/image-generation.md
- **Developed by:** [BRAINIALL Team](https://apify.com/vivid_astronaut) (community)
- **Categories:** AI, Automation, Social media
- **Stats:** 88 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 results

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 Generation

Generate images from text prompts using AI. Create photos, illustrations, artwork, and more with Gemini image generation.

### Features

- **Fast Processing**: Lightning-fast ai image generation powered by Azure
- **Reliable**: 99.9% uptime with automatic failover
- **Scalable**: Handle single requests or bulk operations
- **Secure**: Enterprise-grade security with API key authentication
- **Well Documented**: Comprehensive API documentation and examples

### Use Cases

- **E-commerce**: Process product images at scale
- **Media**: Automate image processing pipelines
- **Apps**: Add image processing to your applications

### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `prompt` | string | Yes | Describe the image you want to generate |
| `prompts` | array | No | List of prompts for batch generation |
| `style` | string | No | Visual style for the generated image |
| `quality` | string | No | Image quality setting |
| `size` | string | No | Output image dimensions |
| `saveToKeyValueStore` | boolean | No | Save generated images to key-value store |

### Output Format

```json
{
  "success": true,
  "result": { ... },
  "timestamp": "2026-01-07T00:00:00Z"
}
```

### Code Examples

#### JavaScript (Node.js)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const input = {
  "prompt": "A beautiful sunset over mountains with a lake reflection",
  "prompts": [
    "A red apple",
    "A blue car",
    "A green forest"
  ],
  "style": "vivid",
  "quality": "standard",
  "size": "1024x1024",
  "saveToKeyValueStore": true
};

const run = await client.actor("vivid_astronaut/image-generation").call(input);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

run_input = {
  "prompt": "A beautiful sunset over mountains with a lake reflection",
  "prompts": [
    "A red apple",
    "A blue car",
    "A green forest"
  ],
  "style": "vivid",
  "quality": "standard",
  "size": "1024x1024",
  "saveToKeyValueStore": true
}

run = client.actor("vivid_astronaut/image-generation").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/vivid_astronaut~image-generation/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A beautiful sunset over mountains with a lake reflection",
  "prompts": [
    "A red apple",
    "A blue car",
    "A green forest"
  ],
  "style": "vivid",
  "quality": "standard",
  "size": "1024x1024",
  "saveToKeyValueStore": true
}'
```

### Pricing

**Model**: Pay per result
**Price**: $0.020 per result

You only pay for successful results. Platform usage costs are included.

### API Documentation

Full API documentation is available at:

- [Apify API Reference](https://docs.apify.com/api/v2)
- [Actor API Endpoints](https://docs.apify.com/api/v2#/reference/actors)

### Support

- **Issues**: Report bugs via Apify Console
- **Documentation**: [Apify Docs](https://docs.apify.com)
- **Community**: [Apify Discord](https://discord.gg/apify)

### Version History

See [CHANGELOG.md](./CHANGELOG.md) for version history.

***

*Powered by Azure Cloud Infrastructure*

# Changelog

This Actor's version history is a separate document: https://apify.com/vivid_astronaut/image-generation/changelog.md

# Actor input Schema

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

Describe the image you want to generate

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

List of prompts for batch generation

## `style` (type: `string`):

Visual style for the generated image

## `quality` (type: `string`):

Image quality setting

## `size` (type: `string`):

Output image dimensions

## `saveToKeyValueStore` (type: `boolean`):

Save generated images to key-value store

## Actor input object example

```json
{
  "prompt": "A beautiful sunset over mountains with a lake reflection",
  "prompts": [
    "A red apple",
    "A blue car",
    "A green forest"
  ],
  "style": "example_style",
  "quality": "example_quality",
  "size": "example_size",
  "saveToKeyValueStore": true
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("vivid_astronaut/image-generation").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("vivid_astronaut/image-generation").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 '{}' |
apify call vivid_astronaut/image-generation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vivid_astronaut/image-generation"
        }
    }
}
```

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/LykeTQnMG0eFplocQ/builds/iE992HbL2hXiBAoqB/openapi.json
