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