Flux Fill Pro Serverless API

Professional inpainting and outpainting model with state-of-the-art performance. Edit or extend images with natural, seamless results.

~23.63s
POST /v2/flux-fill-pro · submit + poll
 1# pip install "segmind>=1.1.0"
 2# export SEGMIND_API_KEY="YOUR_API_KEY"
 3import segmind
 4
 5# Async (v2): submit to the queue and block until COMPLETED.
 6# run() returns the final result dict (600s deadline, 1.0s poll by default).
 7result = segmind.run(
 8    "flux-fill-pro",
 9    mask="https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-mask.jpeg",
10    seed=965222,
11    image="https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-ip.jpg",
12    steps=50,
13    prompt="flower pot on the table",
14    guidance=3,
15    output_format="jpg",
16    safety_tolerance=2,
17    prompt_upsampling=False,
18)
19print(result["status"])                      # COMPLETED
20print(result.get("output"))                  # model output (e.g. media URL)
21print(result["metrics"]["inference_time"])   # server compute seconds
22
23# --- Or submit + poll manually (track request_id, control the cadence) ---
24from segmind import SegmindClient, InferenceFailed, InferenceTimeout
25
26client = SegmindClient()                      # reads SEGMIND_API_KEY
27payload = {
28    "mask": "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-mask.jpeg",
29    "seed": 965222,
30    "image": "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-ip.jpg",
31    "steps": 50,
32    "prompt": "flower pot on the table",
33    "guidance": 3,
34    "output_format": "jpg",
35    "safety_tolerance": 2,
36    "prompt_upsampling": False,
37}
38job = client.submit_async("flux-fill-pro", **payload)
39print(job.request_id)                         # available immediately
40try:
41    result = job.wait(timeout=600, interval=1.0)
42except InferenceTimeout as e:
43    print("still running:", e.request_id)
44except InferenceFailed as e:
45    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/flux-fill-pro

Parameters

imagerequired
string (uri)

The image to inpaint. Can contain an alpha mask. Must be jpeg, png, or webp.

Default: "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-ip.jpg"
maskrequired
string (uri)

A black-and-white image that describes the part of the image to inpaint. Black areas will be preserved while white areas will be inpainted. Must have the same size as image. Optional if you provide an alpha mask in the original image. Must be jpeg, png, or webp.

promptrequired
string

Text prompt for image generation

Default: "flower pot on the table"
guidanceoptional
number

Controls the balance between adherence to the text prompt and image quality/diversity. Higher values make the output more closely match the prompt but may reduce overall image quality. Lower values allow for more creative freedom but might produce results less relevant to the prompt.

Default: 3Range: 2 - 5
output_formatoptional
string

Format of the output images.

Default: "jpg"
Allowed values :
"jpg""png"
prompt_upsamplingoptional
boolean

Automatically modify the prompt for more creative generation

Default: false
safety_toleranceoptional
integer

Safety tolerance, 1 is most strict and 6 is most permissive

Default: 2Range: 1 - 6
seedoptional
integer

Random seed. Set for reproducible generation

Default: 965222
stepsoptional
integer

Number of diffusion steps. Higher values yield finer details but increase processing time.

Default: 50Range: 1 - 50

Response Type

Returns: Image

Asynchronous requests (v2)

Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.

  1. 1
    POST /v2/flux-fill-pro

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • A FAILED request is served as HTTP 422 — the body still carries the error detail.
  • An unknown or expired request_id returns HTTP 404.
  • Results are retained for 1 hour, then expire.
  • Content / RAI blocks surface as FAILED, not a separate state.
  • Track completion by polling the status endpoint.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out