Felo API PlatformFelo API Platform
Back to models

FLUX 3.1 Image API

Free API trial Limited time

Black Forest Labs: FLUX3.1 Image is a hosted image-generation and editing model built for precise revisions, reference-guided consistency, and production workflows.

Black Forest Labs: FLUX3.1 Image accepts image input and produces image output, with output up to16MP and support for4K output. According to the company, it generates a1-megapixel (MP) image in about3 seconds and a16MP output in under15 seconds. Specific pixel dimensions are supported within documented ranges, and dimensions do not need to be divisible by16.

The model is designed for iterative production work and precise image revision. Mask-based editing targets selected areas while preserving surrounding imagery, and up to10 reference images can help maintain composition and consistency across sequences. Prompts can include hexadecimal color codes, and users can specify object or edit placement with1 to32 normalized bounding boxes. Optional web grounding can use real-world references such as named landmarks, species, and objects.

It is suited to e-commerce catalogs, virtual try-on, concept art, storyboards, key art, and localized advertising. Localization tasks can include replacing text on signs, packaging, billboards, and interface mockups while keeping the surrounding design. The model is a hosted API model, distinct from open-weight releases. Actual perceived latency also includes network transfer, queue time, polling, and result download; returned result URLs expire one hour after task completion.

MODEL ID

flux-3-1-image
Released
Context
46.864K
Max output
42.177K
Input
Text / Image
Output
Image

Highlights

  • Precise mask-based editing
  • Up to10 reference images
  • Output up to16MP
  • Supports4K output
  • Optional web grounding

Providers

1 providers

Compare API prices across providers. Select a provider to view all charges and conditions.

Provider · Pricing details
Uptime

Best for

E-commerce catalogsVirtual try-onConcept artStoryboard creationLocalized advertising

Quick Start

Submit an image task, poll its status, then save the images. These examples use curl and Python 3 (standard library only).

POST https://openapi.felo.ai/api/v1/images/generations

1Get your API key

Create a key from your Felo API Platform account and set it as an environment variable.

export FELO_API_KEY="YOUR_API_KEY"

2Make your first request

Optional values vary by model. This example leaves them unset; confirm supported values in Playground before adding them. Request fields sit alongside model and prompt, without an input wrapper.

curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -o created.json \
  -d '{
  "prompt": "A studio product photo of a ceramic coffee cup on warm linen, soft morning light",
  "model": "flux-3-1-image"
}'

3Poll the task

Submission returns task_id. Poll every 3 seconds while queued or running; stop on succeeded, failed or interrupted. This example stops waiting after 30 minutes. Keep created.json to resume querying the same task instead of submitting again.

python3 - <<'PY'
import json, os, time
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen

task = json.loads(Path("created.json").read_text())
task_id = task["task_id"]
url = "https://openapi.felo.ai/api/v1/images/generations/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["FELO_API_KEY"]}
deadline = time.monotonic() + 1800

while task["status"] in ("queued", "running"):
    if time.monotonic() >= deadline:
        raise TimeoutError(f"Keep task_id={task_id} to resume polling")
    time.sleep(3)
    with urlopen(Request(url, headers=headers), timeout=60) as response:
        task = json.load(response)
    if task.get("task_id") != task_id or task.get("kind") != "image":
        raise ValueError("Unexpected task response")
    print(task["status"])

if task["status"] != "succeeded":
    raise RuntimeError(task.get("error") or task["status"])
if not task.get("outputs"):
    raise ValueError("Task succeeded without image outputs")
Path("task.json").write_text(json.dumps(task))
print("Saved task.json")
PY

4Download the output

After success, save outputs from task.json. Results may be HTTPS URLs, URL objects or b64_json. Download signed URLs promptly; media downloads do not use your API key.

python3 - <<'PY'
import base64, json
from pathlib import Path
from urllib.request import urlopen

task = json.loads(Path("task.json").read_text())
if task.get("status") != "succeeded" or not task.get("outputs"):
    raise ValueError("No completed image outputs")
extensions = {"image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif"}

for index, output in enumerate(task["outputs"], 1):
    item = output if isinstance(output, dict) else {}
    url = output if isinstance(output, str) else item.get("url") or item.get("unsigned_url")
    mime = item.get("media_type") or "image/png"
    if url and url.startswith("https://"):
        with urlopen(url, timeout=60) as response:
            data = response.read()
            mime = response.headers.get_content_type()
    elif url and url.startswith("data:image/") and ";base64," in url:
        header, encoded = url.split(",", 1)
        mime = header[5:].split(";", 1)[0]
        data = base64.b64decode(encoded, validate=True)
    elif item.get("b64_json"):
        data = base64.b64decode(item["b64_json"], validate=True)
    else:
        raise ValueError("Unrecognized image output")
    path = Path(f"image-{index}" + extensions.get(mime, ".bin"))
    path.write_bytes(data)
    print(path)
PY
input_references

For image editing, replace the example URL with your HTTPS image URL or a base64 image data URL. Submit once, then use the same polling and saving steps.

curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -o created.json \
  -d '{
  "prompt": "Keep the product and framing. Replace the background with a sunlit marble countertop.",
  "model": "flux-3-1-image",
  "input_references": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://example.com/product.png"
      }
    }
  ]
}'

Supported parameters

  • n
  • seed
  • quality
  • resolution
  • aspect_ratio
  • output_format
  • input_references

Prefer the full reference?

API reference →

Frequently asked questions

What is FLUX 3.1 Image?

Black Forest Labs: FLUX3.1 Image accepts image input and produces image output, with output up to16MP and support for4K output. According to the company, it generates a1-megapixel (MP) image in about3 seconds and a16MP output in under15 seconds. Specific pixel dimensions are supported within documented ranges, and dimensions do not need to be divisible by16. The model is designed for iterative production work and precise image revision. Mask-based editing targets selected areas while preserving surrounding imagery, and up to10 reference images can help maintain composition and consistency across sequences. Prompts can include hexadecimal color codes, and users can specify object or edit placement with1 to32 normalized bounding boxes. Optional web grounding can use real-world references such as named landmarks, species, and objects. It is suited to e-commerce catalogs, virtual try-on, concept art, storyboards, key art, and localized advertising. Localization tasks can include replacing text on signs, packaging, billboards, and interface mockups while keeping the surrounding design. The model is a hosted API model, distinct from open-weight releases. Actual perceived latency also includes network transfer, queue time, polling, and result download; returned result URLs expire one hour after task completion.

How is usage billed?

Your bill depends on the provider you use, its prices and your usage. Longer inputs or other conditions may have different prices. Billed based on the actual generation cost. See your bill for the final amount.

What inputs and outputs does it support?

It supports image input and image output. Up to10 reference images can be used for composition and consistency.

What output size is supported?

Output is up to16MP, with4K output supported. Specific pixel dimensions are available within documented ranges and do not need to be divisible by16.

What kinds of tasks is it suited for?

It is designed for iterative image production and precise revisions, including e-commerce catalogs, virtual try-on, concept art, storyboards, key art, and localized advertising.

How can edits be directed?

Mask-based editing can target selected areas while preserving surrounding imagery. Placement can also be specified with1 to32 normalized bounding boxes, and prompts can include hexadecimal color codes.

How does it differ from sibling models?

The available facts do not describe how FLUX3.1 Image differs from FLUX3 Image Klein or FLUX3.

Related models