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.

~49.03s
~$0.048
 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

POSThttps://api.segmind.com/v1/flux-controlnet

Parameters

imagerequired
string (uri)

Input image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png"
promptrequired
string

The prompt describing the image

Default: "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"
samplerrequired
string

Sampling method for image generation

Default: "euler"
Allowed values (26 total):
"euler""euler_cfg_pp""euler_ancestra""leuler_ancestral_cfg_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+16 more
schedulerrequired
string

Scheduler for image generation

Default: "simple"
Allowed values :
"normal""karras""exponential""sgm_uniform""simple""ddim_uniform""beta"
seedrequired
integer

Random seed for generation

Default: 652889
base64optional
boolean

Output as base64 encoded string

Default: false
cn_stopoptional
number

ControlNet stop parameter

Default: 0.5Range: 0 - 1
cn_strengthoptional
number

ControlNet strength

Default: 0.45Range: 0 - 2
cn_typeoptional
string

ControlNet type

Default: "pose"
Allowed values :
"depth""canny""pose""tile"
custom_heightoptional
integer

Custom height for output image

Default: 1024Range: 64 - 4096
custom_widthoptional
integer

Custom width for output image

Default: 1024Range: 64 - 4096
guidanceoptional
number

Guidance scale for the generation

Default: 3.5Range: 1 - 15
image_formatoptional
string

Output image format

Default: "jpeg"
Allowed values :
"jpeg""png""webp"
qualityoptional
integer

Image quality setting for output

Default: 95Range: 10 - 100
samplesoptional
integer

Number of samples to generate

Default: 1Range: 1 - 4
stepsoptional
integer

Number of steps for generating the image

Default: 20Range: 15 - 75
use_input_img_dimensionoptional
boolean

Use input image dimensions for output image. Uncheck to specify custom height and custom width.

Default: true

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