Flux Fill Pro Serverless API
Professional inpainting and outpainting model with state-of-the-art performance. Edit or extend images with natural, seamless results.
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) 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
https://api.segmind.com/v1/flux-fill-proParameters
imagerequiredstring (uri)The image to inpaint. Can contain an alpha mask. Must be jpeg, png, or webp.
"https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-pro-ip.jpg"maskrequiredstring (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.
promptrequiredstringText prompt for image generation
"flower pot on the table"guidanceoptionalnumberControls 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.
3Range: 2 - 5output_formatoptionalstringFormat of the output images.
"jpg""jpg""png"prompt_upsamplingoptionalbooleanAutomatically modify the prompt for more creative generation
falsesafety_toleranceoptionalintegerSafety tolerance, 1 is most strict and 6 is most permissive
2Range: 1 - 6seedoptionalintegerRandom seed. Set for reproducible generation
965222stepsoptionalintegerNumber of diffusion steps. Higher values yield finer details but increase processing time.
50Range: 1 - 50Response 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
POST /v2/flux-fill-proSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- 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.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out