Flux Controlnets Serverless API
Flux ControlNets is a collection of models that gives you precise control over image generation. By integrating ControlNet with Flux.1, these models enable you to create highly detailed and customized images with unprecedented accuracy.
POST /v2/flux-controlnet · 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-controlnet",
9 base64=False,
10 cn_stop=0.5,
11 cn_strength=0.4,
12 cn_type="pose",
13 custom_height=1024,
14 custom_width=1024,
15 guidance=3.5,
16 image="https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
17 image_format="jpeg",
18 prompt="Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens",
19 quality=95,
20 sampler="euler",
21 samples=1,
22 scheduler="simple",
23 seed=652889,
24 steps=20,
25 use_input_img_dimension=True,
26)
27print(result["status"]) # COMPLETED
28print(result.get("output")) # model output (e.g. media URL)
29print(result["metrics"]["inference_time"]) # server compute seconds
30
31# --- Or submit + poll manually (track request_id, control the cadence) ---
32from segmind import SegmindClient, InferenceFailed, InferenceTimeout
33
34client = SegmindClient() # reads SEGMIND_API_KEY
35payload = {
36 "base64": False,
37 "cn_stop": 0.5,
38 "cn_strength": 0.4,
39 "cn_type": "pose",
40 "custom_height": 1024,
41 "custom_width": 1024,
42 "guidance": 3.5,
43 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
44 "image_format": "jpeg",
45 "prompt": "Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens",
46 "quality": 95,
47 "sampler": "euler",
48 "samples": 1,
49 "scheduler": "simple",
50 "seed": 652889,
51 "steps": 20,
52 "use_input_img_dimension": True,
53}
54job = client.submit_async("flux-controlnet", **payload)
55print(job.request_id) # available immediately
56try:
57 result = job.wait(timeout=600, interval=1.0)
58except InferenceTimeout as e:
59 print("still running:", e.request_id)
60except InferenceFailed as e:
61 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-controlnet",
9 base64=False,
10 cn_stop=0.5,
11 cn_strength=0.4,
12 cn_type="pose",
13 custom_height=1024,
14 custom_width=1024,
15 guidance=3.5,
16 image="https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
17 image_format="jpeg",
18 prompt="Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens",
19 quality=95,
20 sampler="euler",
21 samples=1,
22 scheduler="simple",
23 seed=652889,
24 steps=20,
25 use_input_img_dimension=True,
26)
27print(result["status"]) # COMPLETED
28print(result.get("output")) # model output (e.g. media URL)
29print(result["metrics"]["inference_time"]) # server compute seconds
30
31# --- Or submit + poll manually (track request_id, control the cadence) ---
32from segmind import SegmindClient, InferenceFailed, InferenceTimeout
33
34client = SegmindClient() # reads SEGMIND_API_KEY
35payload = {
36 "base64": False,
37 "cn_stop": 0.5,
38 "cn_strength": 0.4,
39 "cn_type": "pose",
40 "custom_height": 1024,
41 "custom_width": 1024,
42 "guidance": 3.5,
43 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
44 "image_format": "jpeg",
45 "prompt": "Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens",
46 "quality": 95,
47 "sampler": "euler",
48 "samples": 1,
49 "scheduler": "simple",
50 "seed": 652889,
51 "steps": 20,
52 "use_input_img_dimension": True,
53}
54job = client.submit_async("flux-controlnet", **payload)
55print(job.request_id) # available immediately
56try:
57 result = job.wait(timeout=600, interval=1.0)
58except InferenceTimeout as e:
59 print("still running:", e.request_id)
60except InferenceFailed as e:
61 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/flux-controlnetParameters
imagerequiredstring (uri)Input image
"https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png"promptrequiredstringThe prompt describing the image
"Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens"samplerrequiredstringSampling method for image generation
"euler""euler""euler_cfg_pp""euler_ancestra""leuler_ancestral_cfg_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+16 moreschedulerrequiredstringScheduler for image generation
"simple""normal""karras""exponential""sgm_uniform""simple""ddim_uniform""beta"seedrequiredintegerRandom seed for generation
652889base64optionalbooleanOutput as base64 encoded string
falsecn_stopoptionalnumberControlNet stop parameter
0.5Range: 0 - 1cn_strengthoptionalnumberControlNet strength
0.45Range: 0 - 2cn_typeoptionalstringControlNet type
"pose""depth""canny""pose""tile"custom_heightoptionalintegerCustom height for output image
1024Range: 64 - 4096custom_widthoptionalintegerCustom width for output image
1024Range: 64 - 4096guidanceoptionalnumberGuidance scale for the generation
3.5Range: 1 - 15image_formatoptionalstringOutput image format
"jpeg""jpeg""png""webp"qualityoptionalintegerImage quality setting for output
95Range: 10 - 100samplesoptionalintegerNumber of samples to generate
1Range: 1 - 4stepsoptionalintegerNumber of steps for generating the image
20Range: 15 - 75use_input_img_dimensionoptionalbooleanUse input image dimensions for output image. Uncheck to specify custom height and custom width.
trueResponse 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-controlnetSubmit — 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