FLUX 3.1 Image Edit transforms and combines up to 10 input images using natural-language instructions, with masked edits, bounding-box placement, quality and fast modes, and 1K / 2K / 4K output for visual refinements, product compositions, marketing assets, and production workflows. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Idle
/filters:quality(85)/examples/db9b23d8fbe2f54b84239c4c80ece239/202612040337-8dcd987a-46c4-4786-942c-cdc4232ae64-499f380385d2.webp)
$0.03per run·~33 / $1
/filters:quality(82)/examples/db9b23d8fbe2f54b84239c4c80ece239/202612040337-8dcd987a-46c4-4786-942c-cdc4232ae64-499f380385d2.webp)
Replace the entire outdoor scene visible through the café windows with a spectacular underwater civilization. Enormous whales swim between submerged skyscrapers, colorful coral grows along the buildings, and sunlight penetrates the deep blue water. Preserve the exact woman, her clothing, pose, coffee cup, furniture, window frames, and interior composition. Add physically consistent underwater caustic reflections to the interior surfaces while maintaining a clear distinction between the café and the underwater world.
/filters:quality(82)/examples/8b6be383982f8178fec5445bec9826d3/202612040335-c52a2f3e-9296-4d1d-ad21-3ab5f63a856-9b197099370a.webp)
Change and expand the image into a four-panel luxury fashion campaign featuring the same woman in four seasonal outfits: an embroidered floral spring dress, a vibrant tropical summer outfit, a sophisticated camel autumn coat, and an elegant ivory winter fur-trimmed coat. Maintain her exact facial identity, hairstyle, expression, pose, body proportions, and camera framing across all four panels. Give each panel a coordinated seasonal background and add the headings "SPRING", "SUMMER", "AUTUMN", and "WINTER".
/filters:quality(82)/examples/6bbfacda4af115152a89b3210929ca6c/202612040454-a4ed1185-5b28-4bdc-83eb-26fccc6d2df-3220b86d9688.webp)
Print the poster artwork from image 2 on the front of the mug in image 1, wrapped naturally around its curve like a glazed design. Keep the mug's shape and handle, the table, the lighting and the background exactly as they are.
FLUX 3.1 Image Edit changes and combines existing images from natural-language instructions. Provide between 1 and 10 input images, use a mask to indicate an editing region, or add bounding boxes to guide element placement.
Multi-image editing
Combine up to 10 input images in one generation.
Masked edits Paint a mask over the first image to guide edits toward a selected region.
Move, place and remove with bounding boxes Take an element from a box in any input image and place it in a box of the output, or remove it.
Two modes
Choose quality for detail-focused work or fast for lower-cost iteration. Results and processing time vary with the request.
Up to 4K output
Choose 1K, 2K, or 4K.
| Parameter | Required | Description |
|---|---|---|
| prompt | Yes | What to change. Refer to input images by their order (image 1, image 2) and to a bounding box element as <id>. |
| images | Yes | Between 1 and 10 input images (1 to 9 with a mask). Each must be at least 256 pixels per dimension and at most 4 megapixels. |
| mask_image | No | A mask for the first input image: white marks the editing region and black marks areas intended to be preserved. It must have the first image's aspect ratio. |
| bounding_boxes | No | Up to 32 layout elements, each with an optional id and description, a target box, or a paired source_image and source_box. Add a target box to move a source element; omit it to request removal. |
| aspect_ratio | No | 21:9, 2:1, 16:9, 3:2, 7:5, 4:3, 5:4, 1:1, 4:5, 3:4, 5:7, 2:3, 9:16, or 1:2. Leave empty to follow the first input image. Cannot be set together with a mask. |
| resolution | No | 1k, 2k, or 4k. Default: 1k. |
| mode | No | quality or fast. Default: quality. |
| output_format | No | jpeg or png. Default: jpeg. |
A box is an object with four numbers from 0 to 1, measured from the top-left corner of the image as fractions of its width and height: x_min (left), y_min (top), x_max (right), y_max (bottom).
box alone guides placement of a new element in the output.source_image (the number of an input image, starting at 1) with source_box takes the element from that image; with box it requests placement there, and without box it requests removal.Replace the image URL placeholders with your uploaded image URLs.
{
"prompt": "put <man> from image 2 next to the cat in image 1",
"images": ["YOUR_FIRST_IMAGE_URL", "YOUR_SECOND_IMAGE_URL"],
"bounding_boxes": [
{
"id": "man",
"description": "the man",
"source_image": 2,
"source_box": {"x_min": 0.1, "y_min": 0.05, "x_max": 0.9, "y_max": 0.95},
"box": {"x_min": 0.6, "y_min": 0.1, "x_max": 1, "y_max": 0.8}
}
]
}
fast for iteration, quality for the final image.Pricing depends on the selected resolution and mode. Input images, masks and bounding boxes do not add a charge.
| Resolution | Quality | Fast |
|---|---|---|
| 1K | $0.03 | $0.015 |
| 2K | $0.06 | $0.04 |
| 4K | $0.28 | $0.11 |
image 1, image 2, and so on.png to avoid JPEG compression.1–10 images, or 1–9 when using mask_image. The mask applies to the first image.aspect_ratio unset when using it.source_image and source_box. Image numbering starts at 1 and must refer to an image in the request.0 to 1; left must be less than right, and top less than bottom. If supplied, element IDs must be unique within the request.Grab a WaveSpeedAI API key, then call POST https://api.wavespeed.ai/api/v3/black-forest-labs/flux-3.1-image/edit with your input as JSON. The endpoint returns a prediction id. Start polling the result endpoint around every 2 seconds, increase the interval for long-running tasks, and stop on any terminal status. On completed, read output values from data.outputs. Examples for Flux 3.1 Image Edit below.
set -euo pipefail
: "${WAVESPEED_API_KEY:?Set WAVESPEED_API_KEY}"
REQUEST_BODY=$(cat <<'JSON'
{
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"images": [
"https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg"
],
"aspect_ratio": "21:9",
"resolution": "1k",
"mode": "quality",
"output_format": "jpeg"
}
JSON
)
# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
-X POST "https://api.wavespeed.ai/api/v3/black-forest-labs/flux-3.1-image/edit" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-d "$REQUEST_BODY")
TASK=$(printf '%s' "$SUBMIT_RESPONSE" | jq 'if has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "$TASK" | jq -r '.id')
if [ -z "$PREDICTION_ID" ] || [ "$PREDICTION_ID" = "null" ]; then
printf 'Submission response did not contain a prediction id
' >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/$PREDICTION_ID/result"
# 2. Poll until the prediction finishes.
while true; do
RESPONSE=$(curl --silent --show-error --fail-with-body "$RESULT_URL" \
-H "Authorization: Bearer $WAVESPEED_API_KEY")
RESULT=$(printf '%s' "$RESPONSE" | jq 'if has("data") then .data else . end')
STATUS=$(printf '%s' "$RESULT" | jq -r '.status')
case "$STATUS" in
completed) printf '%s\n' "$RESULT" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted) printf '%s\n' "$RESULT" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneconst submitUrl = "https://api.wavespeed.ai/api/v3/black-forest-labs/flux-3.1-image/edit";
const apiKey = process.env.WAVESPEED_API_KEY;
if (!apiKey) throw new Error('Set WAVESPEED_API_KEY');
async function requestJson(url, options = {}) {
const response = await fetch(url, options);
if (!response.ok) throw new Error(await response.text());
return response.json();
}
// 1. Submit the prediction.
const body = await requestJson(submitUrl, {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"images": [
"https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg"
],
"aspect_ratio": "21:9",
"resolution": "1k",
"mode": "quality",
"output_format": "jpeg"
}),
});
const task = body.data ?? body;
if (!task.id) throw new Error("Submission response did not contain a prediction id");
const resultUrl = `https://api.wavespeed.ai/api/v3/predictions/${task.id}/result`;
// 2. Poll until the prediction finishes.
while (true) {
const resultBody = await requestJson(resultUrl, {
headers: { "Authorization": `Bearer ${apiKey}` },
});
const result = resultBody.data ?? resultBody;
if (result.status === "completed") {
console.log(result.outputs);
break;
}
if (["failed", "cancelled", "timeout", "deleted"].includes(result.status)) throw new Error(JSON.stringify(result));
await new Promise(resolve => setTimeout(resolve, 2000));
}import json
import os
import time
from urllib.request import Request, urlopen
api_key = os.environ["WAVESPEED_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
payload = {
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"images": [
"https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg"
],
"aspect_ratio": "21:9",
"resolution": "1k",
"mode": "quality",
"output_format": "jpeg"
}
def request_json(url, data=None):
request = Request(url, data=data, headers=headers, method="POST" if data else "GET")
with urlopen(request) as response:
return json.load(response)
# 1. Submit the prediction.
body = request_json("https://api.wavespeed.ai/api/v3/black-forest-labs/flux-3.1-image/edit", json.dumps(payload).encode())
task = body.get("data", body)
if not task.get("id"):
raise RuntimeError("Submission response did not contain a prediction id")
result_url = f"https://api.wavespeed.ai/api/v3/predictions/{task['id']}/result"
# 2. Poll until the prediction finishes.
while True:
result_body = request_json(result_url)
result = result_body.get("data", result_body)
status = result.get("status")
if status == "completed":
print(result.get("outputs", []))
break
if status in {"failed", "cancelled", "timeout", "deleted"}:
raise RuntimeError(result)
time.sleep(2)Flux 3.1 Image Edit is a Black Forest Labs model for image editing, exposed as a REST API on WaveSpeedAI. FLUX 3.1 Image Edit transforms and combines up to 10 input images using natural-language instructions, with masked edits, bounding-box placement, quality and fast modes, and 1K / 2K / 4K output for visual refinements, product compositions, marketing assets, and production workflows. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing. You can call it programmatically or try it from the playground above.
POST your input parameters to the model's REST endpoint (shown in the API tab of this playground) with your WaveSpeedAI API key in the Authorization header. Submission returns a prediction ID. Poll the result endpoint starting around every 2 seconds, increase the interval for long-running tasks, and stop on any terminal status. The playground generates Python, JavaScript, and cURL examples for submitting requests and polling results. Full request/response shape is documented at https://wavespeed.ai/docs/docs-api/black-forest-labs/flux-3.1-image/edit.
Flux 3.1 Image Edit is billed per run, from $0.015 per run at its lowest settings. Options such as output size, count or quality change the price. The exact price of your current settings is shown on the Generate button before you submit, and the actual charge is recorded on the prediction afterwards.
Key inputs: `prompt`, `images`, `aspect_ratio`, `resolution`, `bounding_boxes`, `mask_image`. The full JSON schema (types, defaults, allowed values) is rendered above the Generate button and mirrored in the API reference at https://wavespeed.ai/docs/docs-api/black-forest-labs/flux-3.1-image/edit.
Sign up for a free WaveSpeedAI account to claim starter credits, copy your API key from /accesskey, then call the endpoint shown in the API tab of the playground. The playground also auto-generates a code sample in Python, JavaScript, or cURL for the parameters you've set.
Commercial usage rights depend on the model's license, set by its provider (Black Forest Labs). Check the provider's applicable terms and WaveSpeedAI's Terms of Service before commercial use.