Flux Fill Dev

Open-weight inpainting model for editing and extending images. Guidance-distilled from FLUX.1 Fill Dev

~17.30s
$0.05 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/flux-fill-dev"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "mask": "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-dev-mask.png",
12    "seed": 985266,
13    "image": "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-dev-ip.png",
14    "prompt": "Green hair",
15    "guidance": 30,
16    "megapixels": "1",
17    "num_outputs": 1,
18    "output_format": "jpg",
19    "output_quality": 80,
20    "num_inference_steps": 28,
21    "disable_safety_checker": false
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27    result = response.json()
28    print(json.dumps(result, indent=2))
29else:
30    print(f"Error: {response.status_code}")
31    print(response.text)

API Endpoint

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

Parameters

imagerequired
string (uri)

The image to inpaint. Can contain alpha mask. If the image width or height are not multiples of 32, they will be scaled to the closest multiple of 32. If the image dimensions don't fit within 1440x1440, it will be scaled down to fit.

Default: "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-fill-dev-ip.png"
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.

promptrequired
string

Prompt for generated image

Default: "Green hair"
disable_safety_checkeroptional
boolean

Disable safety checker for generated images.

Default: false
guidanceoptional
number

Guidance for generated image

Default: 30Range: 0 - 100
megapixelsoptional
string

Approximate number of megapixels for generated image. Use match_input to match the size of the input (with an upper limit of 1440x1440 pixels)

Default: "1"
Allowed values :
"1""0.25""match_input"
num_inference_stepsoptional
integer

Number of denoising steps. Recommended range is 28-50, and lower number of steps produce lower quality outputs, faster.

Default: 28Range: 1 - 50
num_outputsoptional
integer

Number of outputs to generate

Default: 1Range: 1 - 4
output_formatoptional
string

An enumeration.

Default: "jpg"
Allowed values :
"webp""jpg""png"
output_qualityoptional
integer

Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs

Default: 80Range: 0 - 100
seedoptional
integer

Random seed. Set for reproducible generation

Default: 985266

Response Type

Returns: Image

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