Flux Controlnets
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.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-controlnet"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "base64": false,
12 "cn_stop": 0.5,
13 "cn_strength": 0.4,
14 "cn_type": "pose",
15 "custom_height": 1024,
16 "custom_width": 1024,
17 "guidance": 3.5,
18 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
19 "image_format": "jpeg",
20 "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",
21 "quality": 95,
22 "sampler": "euler",
23 "samples": 1,
24 "scheduler": "simple",
25 "seed": 652889,
26 "steps": 20,
27 "use_input_img_dimension": true
28}
29
30response = requests.post(url, headers=headers, json=data)
31
32if response.status_code == 200:
33 result = response.json()
34 print(json.dumps(result, indent=2))
35else:
36 print(f"Error: {response.status_code}")
37 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-controlnet"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "base64": false,
12 "cn_stop": 0.5,
13 "cn_strength": 0.4,
14 "cn_type": "pose",
15 "custom_height": 1024,
16 "custom_width": 1024,
17 "guidance": 3.5,
18 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png",
19 "image_format": "jpeg",
20 "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",
21 "quality": 95,
22 "sampler": "euler",
23 "samples": 1,
24 "scheduler": "simple",
25 "seed": 652889,
26 "steps": 20,
27 "use_input_img_dimension": true
28}
29
30response = requests.post(url, headers=headers, json=data)
31
32if response.status_code == 200:
33 result = response.json()
34 print(json.dumps(result, indent=2))
35else:
36 print(f"Error: {response.status_code}")
37 print(response.text)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
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