Black Forest Labs
FLUX 3.1
flux-3.1/edit-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/edit-image
Input
Showcases
View all showcasesOutput
Pricing
flux-3.1/edit-image per image
| Specifications | Unit Price |
|---|---|
| 1K | |
| 2K | |
| 4K | |
Positioning Overview
Designed for creators and developers who need to modify existing images while preserving the original image structure: provide an editing instruction along with 1 to 10 HTTPS reference images, and the model executes the instruction on the image to produce a static image. You can choose one of three output resolutions—1k, 2k, or 4k—with 1k as the default; choose between auto and a variety of fixed aspect ratios; and select jpeg or png as the output format. The content moderation tolerance is set with an integer from 0 to 6, and automatic prompt expansion can be enabled as needed. It is well suited for iterative fine-tuning work in which reference images anchor the editing scope.
Key Highlights
- Reference-image-driven editing — Submit 1 to 10 HTTPS image addresses per request as references, and the model modifies the image based on them rather than generating from scratch from text alone.
- Output specifications set per request — Each request selects one of 1k, 2k, or 4k, one of auto and a variety of fixed aspect ratios, and output in jpeg or png.
- Optional automatic prompt expansion — When enabled, brief editing instructions are expanded into more complete descriptions, reducing the need to add details manually; it is disabled by default, and can remain off when instructions are already specific.
Capability Description
- Multi-reference instruction editing: Submit 1 to 10 HTTPS image addresses plus an editing instruction, and the model adjusts the image according to the instruction; suited to modifying content while preserving the subject or composition, and it is recommended to state the areas to change and the areas to preserve in the instruction.
- Resolution and aspect ratio selection: Each request selects one of three output resolutions—1k, 2k, or 4k—and specifies an aspect ratio, with 1k and auto as defaults; auto is decided by the model, and ratios such as 2:1, 16:9, 1:1, and 9:16 can also be selected.
- Output format and moderation adjustment: Output can be jpeg or png; the content moderation tolerance is set with an integer from 0 to 6, where higher values are more permissive, with a default of 2, making it easy to control generation boundaries per scenario.
- Automatic prompt expansion: When prompt expansion is enabled, the system supplements brief editing instructions into more complete descriptions before executing the edit, which is suitable when instructions are relatively brief; it is disabled by default, and keeping it off when instructions are already specific enough makes results easier to control.
Use Cases
- Changing backgrounds in real product photos — E-commerce operators use a real product photo as the primary reference image and instruct the replacement or adjustment of the background; the primary image carries the product subject, while the other reference images can provide the target background or color scheme cues. After output, check whether the outer contour and original cast shadows remain stable, then select the aspect ratio and resolution according to platform requirements.
- Adjusting color schemes of material samples — Designers use a material sample as the primary reference image and modify the color scheme with instructions, while the other reference images indicate the source of the target tones. After output, check the texture direction and seam positions, confirm that preserved areas show no unexpected changes, and then choose jpeg or png for layout.
- Changing the light direction of existing illustrations — Illustrators use an existing illustration as the primary reference image and describe changes in light direction with instructions, while the other reference images can indicate the light direction. After output, check whether the light-to-dark transitions and shadow directions match the instructions and whether the contours of preserved areas are maintained, then use it for layout or review.
Limitations and Selection Advice
Each request must provide at least 1 reference image, and image addresses must be HTTPS links, with a maximum of 10; the editing instruction is required and can be up to 4000 characters. The output resolution must be one of 1k, 2k, or 4k, and the aspect ratio and output format are likewise chosen singly per request, so multiple specifications cannot be obtained in a single request. The content moderation tolerance is an integer from 0 to 6, with a default of 2. The output is a static image, with no video or audio output. The model does not guarantee masks, pixel-level locking, transparent cutouts, or automatic color preservation; for edits involving preserved areas, it is recommended to state the preservation scope in the instruction and check the outer contour and original cast shadows.
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/edit-image
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for flux-3.1/edit-image and route default — see the parameter table below.
promptstringRequiredminLength 1maxLength 4000Instruction text describing the modifications to apply to the reference image.
image_urlsarrayRequiredminItems 1maxItems 10Array of reference image URLs, providing 1–10 images as editing inputs.
Array [ string ]
resolutionstringOptionalDefault: "1k"Output resolution tier, as a string value, default 1k.
1k2k4kaspect_ratiostringOptionalDefault: "auto"Output aspect ratio, as a string value, default auto (decided 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"Output image format, as a string value, default jpeg.
jpegpngsafety_toleranceintegerOptionalDefault: 2min 0max 6Content moderation tolerance, as an integer value; higher values mean more lenient moderation, default 2.
enable_prompt_expansionbooleanOptionalDefault: falseWhether to automatically expand the prompt, as a boolean value, default false.
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/edit-image",
"input": {
"prompt": "…",
"image_urls": "…",
"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/edit-image",
input: {
"prompt": "…",
"image_urls": "…",
"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/edit-image",
"input": {
"prompt": "…",
"image_urls": "…",
"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 →-
Guide
flux-3.1/edit-image Getting Started Guide: Capability Boundaries, API Parameters, and Pricing Practices
-
Comparison
flux-3.1/edit-image Side-by-Side Comparison: Choosing and Migrating Image Editing Models
-
Tutorial
FLUX 3.1 Reference Image Editing: How to Divide Roles Between the Main Image, Color Card, and Background Image
-
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
-
Tutorial
Hands-on with flux-3.1/edit-image: 5 high-value image editing application scenarios
From integration to cost accounting, bringing image editing models into real business
-
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
Related Models
View all models →Same Type
-
Qwen Image 2.1 Alibaba $0.020 /image -
FLUX 3 Image Klein Black Forest Labs $0.0092 /image -
FLUX 3 Image Black Forest Labs $0.041 /image -
Krea 2 Medium Turbo Krea $0.021 /image -
Midjourney Midjourney $0.064 per call -
FIBO 2.0 Bria $0.057 /image -
BRIA Eraser Bria $0.058 /image -
FASHN Tryon v1.6 FASHN $0.107 /image -
MAI Image 2.7 Microsoft $0.015 /image -
Ideogram 4.6 Ideogram $0.011 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
Nano Banana 2 Lite Google $0.033 /image
Same Provider
-
FLUX.2 Black Forest Labs $0.035 /image -
FLUX 3 Image Klein Black Forest Labs $0.0092 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
FLUX.2 Klein 4B Black Forest Labs $0.0004 /image -
FLUX 3 Max Black Forest Labs $0.243 /second -
FLUX.1 Kontext Max Black Forest Labs $0.071 /image -
FLUX 3 Video Black Forest Labs $0.090 /second -
FLUX 3 Image Black Forest Labs $0.041 /image -
FLUX.1 Fill Pro Black Forest Labs $0.071 /image -
FLUX.2 Klein 9B Black Forest Labs $0.0086 /image -
FLUX 1.1 Pro Black Forest Labs $0.050 /image


