Black Forest Labs
FLUX 3.1
flux-3.1/text-to-image
Black Forest Labs' FLUX 3.1 image models, available in Quality and Fast tiers, with separate pipelines for text-to-image and editing. Supports 1K, 2K, and native 4K, and editing accepts up to 10 reference images.
Try flux-3.1/text-to-image
Input
Showcases
View all showcasesOutput
imagePricing
flux-3.1/text-to-image per image
| Specifications | Unit Price |
|---|---|
| 1K | |
| 2K | |
| 4K | |
Overview
This is a text-only model that generates static images: input a scene description and get an image back. It supports three output resolution tiers—1k, 2k and 4k (1k by default)—so you can pick one to suit the use case. Aspect ratios cover common landscape and portrait formats from 21:9 to 9:21, with auto as the default. The output format can be switched between jpeg and png. You can also enable automatic prompt expansion to turn a short description into a more complete scene. It suits designers and content creators who need to quickly produce concept art, poster backgrounds or advertising sketches.
Key Highlights
- Spatial relationships and layering can be controlled via the prompt—describe the subject, environment and lighting clearly in the prompt, and the model can organize the spatial layers of the image accordingly, making it suitable for concept art and still-life arrangements.
- Resolution tiers from 1k to 4k—each request selects one of 1k, 2k or 4k, with 1k as the default; this covers different stages from quick sketches to higher-fidelity final images.
- Aspect ratios match layout needs—supports auto plus a choice of ratios such as 21:9, 16:9, 1:1 and 9:16, so landscape posters and portrait illustrations can be set separately, reducing post-crop work.
Capabilities
- Generate static images from prompts: input a scene description of up to 4000 characters to generate a single static image; the description should cover elements such as subject, lighting and style, making it suitable for early exploration of paper-craft posters or scene concept art.
- Resolution tier selection: each request selects one of 1k, 2k or 4k to set the output resolution, with 1k as the default; this covers different stages from quick previews to higher-fidelity final images.
- Aspect ratio adaptation: choose one of auto, 21:9, 16:9, 1:1, 9:16 and other ratios to change the width-to-height relationship of the image so it matches a landscape poster or portrait illustration layout.
- Prompt expansion and format switching: after enabling enable_prompt_expansion, the system automatically expands short prompts; the output can be set to either jpeg or png, making it easy to feed directly into web or design workflows.
Use Cases
- Designers exploring paper-craft poster backgrounds—use a prompt describing paper layering and light direction, choose 2k or 4k resolution and a landscape ratio, and generate a background that can be used in layout exploration, checking whether the subject leaves room for copy.
- Still-life arrangement concept art—use the 1k tier to quickly generate a scene concept image of a still-life arrangement, describing the front-to-back relationships of objects and the lighting, for early communication and direction screening; once confirmed, raise the resolution tier for refinement.
- Scene concept art exploration—use a longer prompt to describe environmental layers and atmosphere, first generating at the 1k tier for direction screening, then adjusting the resolution as needed to produce visual references for concept discussions.
- Vertical social media illustrations—content creators output png or jpeg images at a 9:16 or 1:1 ratio, pairing short prompts to produce social media visuals that can be used directly as post covers or accompanying images.
Limitations and Selection Advice
This pipeline accepts only text descriptions, not reference images; if you need image-guided generation, switch to the Quality editing pipeline in the same family, which supports 1–10 reference images. Prompts are limited to 4000 characters, and longer ones cannot be submitted. Output resolution, aspect ratio and format can each be set to only one value per request. Results are affected by prompt wording, and exact spatial positions of image elements or text layout cannot be guaranteed; complex typography may require multiple description adjustments or post-editing.
What's new
View changelog →- New model New model release: flux-3.1/text-to-image
Frequently asked questions
View all FAQs →-
Can Quality text-to-image directly take a reference image and edit it?
No. This route only accepts text descriptions and does not accept any image input; to edit an image based on a reference image, use Quality Edit or Fast Edit instead, which require 1–10 HTTPS images. If you only have text-based creation needs, just use this route directly; aspect ratio, resolution, and output format are all set separately in the request.
-
How can I write Quality text-to-image prompts for more stable results?
Write in the order of "subject — action and scene — composition and viewpoint — lighting and atmosphere — style and image quality," covering these five categories of elements in a single paragraph; this is more reliable than piling up keywords. The prompt limit is 4000 characters, but you don't need to fill it up; put the elements you want to lock in first and secondary modifiers later, so it's easier for you to delete, edit, and pinpoint problems.
-
How many reference images can a single Quality edit take?
You can provide anywhere from 1 to 10, and they must all be HTTPS URLs. When using multiple images, clearly state in the edit instruction what role each image plays, for example which one is the main image and which one provides material or color reference; otherwise the model can only guess. The instruction is likewise subject to the 4000-character limit.
-
How do I configure Quality editing to output a large 4K image?
Just set resolution to 4k; the available values are 1k, 2k, and 4k, with 1k as the default. Specify the aspect ratio with aspect_ratio; auto lets the model decide on its own. For the output format, choose between jpeg and png with output_format; the default is jpeg. If you want lossless detail preservation, choose png.
Create a generation task
https://api.hiapi.sh/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: flux-3.1/text-to-image
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for flux-3.1/text-to-image and route default — see the parameter table below.
promptstringRequiredminLength 1maxLength 4000Textual description of the image, used as the semantic input for image generation, provided as a string.
resolutionstringOptionalDefault: "1k"Resolution tier of the output image, provided as a string, defaults to 1k.
1k2k4kaspect_ratiostringOptionalDefault: "auto"Aspect ratio of the output image, provided as a string, defaults to auto (determined automatically by the model).
auto21:92:116:93:27:54:35:4Show all (6)Show less
1:14:53:42:39:219:16output_formatstringOptionalDefault: "jpeg"Format of the output image, provided as a string, defaults to jpeg.
jpegpngsafety_toleranceintegerOptionalDefault: 2min 0max 6Content moderation tolerance, an integer; the larger the value, the more lenient the moderation, defaults to 2.
enable_prompt_expansionbooleanOptionalDefault: falseWhether to automatically expand the prompt, a boolean, defaults to false (no expansion).
callbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.sh/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-3.1/text-to-image",
"input": {
"prompt": "…",
"resolution": "1k",
"aspect_ratio": "auto",
"output_format": "jpeg",
"safety_tolerance": 2,
"enable_prompt_expansion": false
}
}' const res = await fetch("https://api.hiapi.sh/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "flux-3.1/text-to-image",
input: {
"prompt": "…",
"resolution": "1k",
"aspect_ratio": "auto",
"output_format": "jpeg",
"safety_tolerance": 2,
"enable_prompt_expansion": false
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.sh/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "flux-3.1/text-to-image",
"input": {
"prompt": "…",
"resolution": "1k",
"aspect_ratio": "auto",
"output_format": "jpeg",
"safety_tolerance": 2,
"enable_prompt_expansion": False
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.sh/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →-
Comparison
How to Choose Among the Four FLUX 3.1 Routes: A Decision Guide for Text-to-Image and Edit Routes
Choose Quality/Fast and text-to-image/edit based on asset type and resolution tier
-
Guide
FLUX 3.1 Cover Generation in Practice: Defining Whitespace, Light Direction, and Aspect Ratio with a Single Prompt
Composition checks and 1K price comparison for the Quality and Fast text-to-image lines
-
Comparison
flux-3.1/text-to-image Selection Guide: A Side-by-Side Comparison with Comparable Text-to-Image Models
Decide based on per-image output price, integration complexity, and migration cost
-
Guide
Two Ways to Use FLUX 3.1 Quality: Generating a New Image from Scratch or Editing Existing Material
Two delivery paths under the same physical window-display project
-
Tutorial
flux-3.1/text-to-image in Practice: 5 High-Value Business Scenarios and Integration Essentials
From per-image billing to production readiness: integrating an image generation model into real business
-
Guide
flux-3.1/text-to-image Getting Started Guide: Capabilities, Pricing, and Integration Practices
A decision checklist for developers integrating third-party image models
Related Models
View all models →Same Type
-
Midjourney Midjourney $0.064 per call -
Wan 2.7 Image Alibaba $0.035 /image -
Qwen Image 2.0 Alibaba $0.042 /image -
Hunyuan Image 3.0 Tencent $0.135 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
Google Virtual Try-On Google $0.107 /image -
851 Labs Background Remover 851 Labs $0.002 /image -
FLUX 3 Image Klein Black Forest Labs $0.0092 /image -
Qwen Image 3.0 Alibaba $0.036 /image -
Grok Imagine Quality xAI $0.070 /image -
MAI Image 2.7 Microsoft $0.015 /image -
Seedream 5.5 ByteDance $0.019 /image
Same Provider
-
FLUX 3 Image Black Forest Labs $0.041 /image -
FLUX.2 Black Forest Labs $0.035 /image -
FLUX 3 Image Klein Black Forest Labs $0.0092 /image -
FLUX.2 Klein 9B Black Forest Labs $0.0086 /image -
FLUX.1 Fill Pro Black Forest Labs $0.071 /image -
FLUX.2 Klein 4B Black Forest Labs $0.0004 /image -
FLUX 3 Video Black Forest Labs $0.090 /second -
FLUX 1.1 Pro Black Forest Labs $0.050 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
FLUX.1 Kontext Max Black Forest Labs $0.071 /image -
FLUX 3 Max Black Forest Labs $0.243 /second


