flux-2
Black Forest Labs FLUX.2 on reAPI — async photoreal text-to-image and multi-reference editing, in Pro and Flex tiers, on one OpenAI-compatible endpoint.
Black Forest Labs' FLUX.2 on reAPI — photoreal text-to-image and
multi-reference editing (up to 8 images), with accurate in-image text.
Two tiers: flux-2 (Pro) and flux-2-flex (Flex). Submit returns a
task_id; poll until ready. See current pricing on the
model page.
Quick example
curl https://reapi.ai/api/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-2",
"prompt": "an infographic poster titled OPENING SOON, clean layout",
"aspect_ratio": "3:4",
"resolution": "2K"
}'import requests
resp = requests.post(
"https://reapi.ai/api/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "flux-2",
"prompt": "an infographic poster titled OPENING SOON, clean layout",
"aspect_ratio": "3:4",
"resolution": "2K",
},
timeout=30,
)
print(resp.json())const r = await fetch("https://reapi.ai/api/v1/images/generations", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "flux-2",
prompt: "an infographic poster titled OPENING SOON, clean layout",
aspect_ratio: "3:4",
resolution: "2K",
}),
});
console.log(await r.json());package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "flux-2",
"prompt": "an infographic poster titled OPENING SOON, clean layout",
"aspect_ratio": "3:4",
"resolution": "2K",
})
req, _ := http.NewRequest("POST",
"https://reapi.ai/api/v1/images/generations", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}Submit response
{
"id": "task_018f5a3a1b6e7d9f8c2b4d6e8f0a2c4e",
"model": "flux-2",
"status": "processing",
"created_at": 1735000000
}Poll GET /api/v1/tasks/{id} (see the Tasks reference) until
status === "completed". The completed payload's output.image_urls holds the
generated image URL.
Authentication
Every call needs a Bearer token. Generate keys at reapi.ai/settings/apikeys.
Authorization: Bearer YOUR_API_KEYEndpoint
POST /api/v1/images/generations
GET /api/v1/tasks/{id}Submission is async. The POST returns immediately with a task_id; the task
endpoint returns the same envelope until completion. Polling does not consume
credits.
Tiers
Two customer model ids share one parameter shape:
| Model id | Tier | Notes |
|---|---|---|
flux-2 | Pro | Production-ready, fast, lower price. The default tier. |
flux-2-flex | Flex | Maximum quality / detail, higher price. |
Modes
There is no mode field — the modality is implicit in the request shape:
- Text-to-image — no
input_urls. - Image-to-image / multi-reference editing — pass
input_urls(1–8 reference images). FLUX.2 keeps characters, products, and styles consistent across the result.
Request body
model — string, required
One of flux-2 (Pro) or flux-2-flex (Flex).
prompt — string, required
3–5,000 characters. Put any text you want rendered in the image in quotes.
input_urls — array, optional
1–8 reference images for image-to-image / multi-reference editing. Public
HTTPS URLs only — base64 / data: URIs are rejected at the gateway. Passing
any image switches the request to editing mode.
aspect_ratio — string, default 1:1
One of 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3. The value auto
(match the first reference image) is available only for image-to-image.
aspect_ratio: "auto" requires input_urls. Using it without reference images
(text-to-image) is rejected with 400.
resolution — string, default 1K
1K or 2K. The 2K tier renders up to 4MP.
nsfw_checker — boolean, optional, default false
Enables upstream content moderation. Off by default.
Pricing
FLUX.2 bills a flat rate per generated image, by tier (flux-2 /
flux-2-flex) and resolution (1K / 2K). Text-to-image and image-to-image
cost the same within a tier:
credits = ceil(per_image_usd × 1000)where 1 credit = $0.001 USD. Each request produces one image. Failed and
rejected requests are not charged.
The exact per-image credit cost for each tier/resolution surfaces on the model page and through the playground estimator before submit.
Response
The poll envelope returns the image URL in output.image_urls:
{
"id": "task_019dfd44b7fd74168541552a3260a623",
"model": "flux-2",
"status": "completed",
"output": {
"image_urls": [
"https://cdn.reapi.ai/...jpg"
]
}
}Generated URLs expire — mirror them to your own storage if you need long-term retention.
Errors
Failures return the standard reAPI envelope { error: { code, message, request_id } }. Common cases:
- Invalid input (prompt outside 3–5000 chars, more than 8
input_urls,autoaspect without reference images, a non-HTTPS URL) →400. - Insufficient credits →
402. - Rate limited →
429.
See the full catalog at /docs/api/errors.
Tips
- Put the literal text you want rendered in the prompt, in quotes — FLUX.2 is tuned for legible typography, ad headlines, and infographics.
- For consistency across a campaign, pass the same reference image(s) in
input_urlsand let FLUX.2 keep the character/style on-model. - Use
flux-2(Pro) for fast, cost-efficient production andflux-2-flex(Flex) when a hero shot needs maximum quality. - Reach for
resolution: "2K"(up to 4MP) only when the asset needs the detail.