FLUX 3.1 Image Editing API

black-forest-labs/flux-3.1-image/edit

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.

Image Editing
Input

Drag & drop or click to upload

preview

Hint: You can drag and drop a file or click to upload

Idle

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.

$0.03per run·~33 / $1

ExamplesView all

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.

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.

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".

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".

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.

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.

Related Models

README

FLUX 3.1 Image Edit

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.

Why Choose This?

  • 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.

Parameters

ParameterRequiredDescription
promptYesWhat to change. Refer to input images by their order (image 1, image 2) and to a bounding box element as <id>.
imagesYesBetween 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_imageNoA 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_boxesNoUp 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_ratioNo21: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.
resolutionNo1k, 2k, or 4k. Default: 1k.
modeNoquality or fast. Default: quality.
output_formatNojpeg or png. Default: jpeg.

Bounding boxes

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}
    }
  ]
}

How to Use

  1. Upload the input images — In the order you will refer to them.
  2. Write the instruction — Say what should change and what should stay.
  3. Add a mask (optional) — Paint over the area of the first image that may change.
  4. Add boxes (optional) — Place, move or remove elements by their boxes.
  5. Choose resolution and mode — fast for iteration, quality for the final image.
  6. Submit — Generate and retrieve the edited image.

Pricing

Pricing depends on the selected resolution and mode. Input images, masks and bounding boxes do not add a charge.

ResolutionQualityFast
1K$0.03$0.015
2K$0.06$0.04
4K$0.28$0.11

Best Use Cases

  • Product compositions — Combine product references with a new setting or layout.
  • Visual revisions — Adjust colors, materials, clothing or scene details.
  • Localized edits — Guide changes toward a selected region with a mask.
  • Layout exploration — Try different placements for referenced subjects and objects.

Pro Tips

  • With a mask, describe only what should appear inside the painted area.
  • Refer to each input clearly as image 1, image 2, and so on.
  • State what must stay unchanged when precision matters.
  • Use fewer references when several images give conflicting guidance.
  • Choose png to avoid JPEG compression.

Notes

  • Provide 1–10 images, or 1–9 when using mask_image. The mask applies to the first image.
  • Use a mask with the same aspect ratio as the first image and leave aspect_ratio unset when using it.
  • For a source element, provide both source_image and source_box. Image numbering starts at 1 and must refer to an image in the request.
  • Box coordinates range from 0 to 1; left must be less than right, and top less than bottom. If supplied, element IDs must be unique within the request.
  • Masks and boxes guide the edit. Review the result for changes to surrounding details, subject appearance and text.

Related Models

Note:This website uses AI models provided by third parties. Documentation prices are for reference and may be outdated. The Generate button shows an estimate; the final task charge prevails.

Flux 3.1 Image Edit API — Quick start

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.

HTTP example
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
done
Node.js example
const 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));
}
Python example
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 API — Frequently asked questions

What is the Flux 3.1 Image Edit API?

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.

How do I call the Flux 3.1 Image Edit API?

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.

How much does Flux 3.1 Image Edit cost?

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.

What inputs does Flux 3.1 Image Edit accept?

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.

How do I get started with the Flux 3.1 Image Edit API?

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.

Can I use Flux 3.1 Image Edit outputs commercially?

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.

llms.txt — black-forest-labs/flux-3.1-image/edit for AI agents and LLMs