Flux Image Generation
Generate and edit images through AceDataCloud's Flux API.
Setup: See authentication for token setup.
Quick Start
curl -X POST https://api.acedata.cloud/flux/images \
-H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"action": "generate", "prompt": "a cat wearing a space helmet, photorealistic", "model": "flux-dev", "callback_url": "https://api.acedata.cloud/health"}'
Async: See async task polling. Poll via POST /flux/tasks with {"id": "..."}.
Models
| Model |
Quality |
Speed |
Sizes |
Best For |
flux-dev |
Good |
Fast |
256–1440px |
Quick generation (default) |
flux-pro |
High |
Medium |
256–1440px |
Production work |
flux-2-klein |
Good |
Fastest |
256–1440px |
Compact / lowest-latency Flux 2 generation |
flux-2-flex |
High |
Fast |
256–1440px |
Faster high-quality generation |
flux-2-pro |
Higher |
Medium |
256–1440px |
Better prompt following |
flux-2-max |
Highest |
Slow |
256–1440px |
Maximum quality generation |
flux-kontext-pro |
High |
Medium |
Aspect ratios |
Image editing |
flux-kontext-max |
Highest |
Slow |
Aspect ratios |
Complex editing |
Generate Images
POST /flux/images
{
"prompt": "a minimalist logo of a mountain",
"action": "generate",
"model": "flux-2-pro",
"size": "1024x1024",
"count": 1
}
Size Options
For dev/pro/flux-2 (pixel dimensions):
"1024x1024", "1344x768", "768x1344", "1024x576", "576x1024"
For kontext (aspect ratios):
"1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "21:9", "9:21"
Edit Images
Use kontext models for text-guided image editing:
POST /flux/images
{
"prompt": "change the background to a beach sunset",
"action": "edit",
"image_url": "https://example.com/photo.jpg",
"model": "flux-kontext-pro"
}
Gotchas
- Use pixel dimensions (e.g.,
"1024x1024") with dev/pro/flux-2 models, aspect ratios (e.g., "16:9") with kontext models
- Editing requires kontext models (
flux-kontext-pro or flux-kontext-max) — other models only support generation
count parameter generates multiple images in one request (increases cost proportionally)
flux-2-klein is the lightest Flux 2 model — useful when latency matters more than peak quality
flux-2-max produces highest quality but is slowest — use dev/klein/flex for iteration and max for final output
- All generation is async — always set
"callback_url" to get a task id immediately, then poll /flux/tasks using {"id":"<task_id>"} or {"ids":[...],"action":"retrieve_batch"}
MCP: pip install mcp-flux-pro | Hosted: https://flux.mcp.acedata.cloud/mcp | See all MCP servers
1---2name: flux-image3description: Generate and edit images with Flux (Black Forest Labs) via AceDataCloud API. Use when creating images from text prompts, editing existing images with text instructions, or when high-quality image generation is needed. Supports multiple Flux models including dev, pro, Flux 2 variants, and kontext for editing.4license: Apache-2.05---6
7# Flux Image Generation
8
9Generate and edit images through AceDataCloud's Flux API.
10
11> **Setup:** See [authentication](../_shared/authentication.md) for token setup.
12
13## Quick Start
14
15```bash
16curl -X POST https://api.acedata.cloud/flux/images \
17 -H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
18 -H "Content-Type: application/json" \
19 -d '{"action": "generate", "prompt": "a cat wearing a space helmet, photorealistic", "model": "flux-dev", "callback_url": "https://api.acedata.cloud/health"}'
20```
21
22> **Async:** See [async task polling](../_shared/async-tasks.md). Poll via `POST /flux/tasks` with `{"id": "..."}`.
23
24## Models
25
26| Model | Quality | Speed | Sizes | Best For |
27|-------|---------|-------|-------|----------|
28| `flux-dev` | Good | Fast | 256–1440px | Quick generation (default) |
29| `flux-pro` | High | Medium | 256–1440px | Production work |
30| `flux-2-klein` | Good | Fastest | 256–1440px | Compact / lowest-latency Flux 2 generation |
31| `flux-2-flex` | High | Fast | 256–1440px | Faster high-quality generation |
32| `flux-2-pro` | Higher | Medium | 256–1440px | Better prompt following |
33| `flux-2-max` | Highest | Slow | 256–1440px | Maximum quality generation |
34| `flux-kontext-pro` | High | Medium | Aspect ratios | Image editing |
35| `flux-kontext-max` | Highest | Slow | Aspect ratios | Complex editing |
36
37## Generate Images
38
39```json
40POST /flux/images
41{
42 "prompt": "a minimalist logo of a mountain",
43 "action": "generate",
44 "model": "flux-2-pro",
45 "size": "1024x1024",
46 "count": 1
47}
48```
49
50### Size Options
51
52**For dev/pro/flux-2** (pixel dimensions):
53- `"1024x1024"`, `"1344x768"`, `"768x1344"`, `"1024x576"`, `"576x1024"`
54
55**For kontext** (aspect ratios):
56- `"1:1"`, `"16:9"`, `"9:16"`, `"4:3"`, `"3:4"`, `"3:2"`, `"2:3"`, `"21:9"`, `"9:21"`
57
58## Edit Images
59
60Use kontext models for text-guided image editing:
61
62```json
63POST /flux/images
64{
65 "prompt": "change the background to a beach sunset",
66 "action": "edit",
67 "image_url": "https://example.com/photo.jpg",
68 "model": "flux-kontext-pro"
69}
70```
71
72## Gotchas
73
74- Use pixel dimensions (e.g., `"1024x1024"`) with dev/pro/flux-2 models, aspect ratios (e.g., `"16:9"`) with kontext models
75- Editing requires kontext models (`flux-kontext-pro` or `flux-kontext-max`) — other models only support generation
76- `count` parameter generates multiple images in one request (increases cost proportionally)
77- `flux-2-klein` is the lightest Flux 2 model — useful when latency matters more than peak quality
78- `flux-2-max` produces highest quality but is slowest — use dev/klein/flex for iteration and max for final output
79- All generation is async — always set `"callback_url"` to get a task id immediately, then poll `/flux/tasks` using `{"id":"<task_id>"}` or `{"ids":[...],"action":"retrieve_batch"}`
80
81> **MCP:** `pip install mcp-flux-pro` | Hosted: `https://flux.mcp.acedata.cloud/mcp` | See [all MCP servers](../_shared/mcp-servers.md)