SDXL Controlnet
SDXL ControlNet gives unprecedented control over text-to-image generation. SDXL ControlNet models Introduces the concept of conditioning inputs, which provide additional information to guide the image generation process
1import requests
2import json
3
4url = "https://api.segmind.com/v1/sdxl-controlnet"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-controlnet-input.jpeg",
12 "prompt": "American woman, smiling, waving, eyeglasses, casual clothing, sitting at desk, laptop, home office, indoor, daylight, modern decor, house plants, bookshelf, natural lighting",
13 "negative_prompt": "low quality, ugly, painting, extra fingers, deformed",
14 "samples": 1,
15 "scheduler": "UniPC",
16 "cn_model": "sdxl_canny",
17 "num_inference_steps": 30,
18 "guidance_scale": 6,
19 "seed": 760941192,
20 "controlnet_scale": 0.9,
21 "base64": 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) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/sdxl-controlnet"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-controlnet-input.jpeg",
12 "prompt": "American woman, smiling, waving, eyeglasses, casual clothing, sitting at desk, laptop, home office, indoor, daylight, modern decor, house plants, bookshelf, natural lighting",
13 "negative_prompt": "low quality, ugly, painting, extra fingers, deformed",
14 "samples": 1,
15 "scheduler": "UniPC",
16 "cn_model": "sdxl_canny",
17 "num_inference_steps": 30,
18 "guidance_scale": 6,
19 "seed": 760941192,
20 "controlnet_scale": 0.9,
21 "base64": 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
https://api.segmind.com/v1/sdxl-controlnetParameters
imagerequiredstring (uri)Input Image
promptrequiredstringPrompt to render
base64optionalbooleanBase64 encoding of the output image.
falsecn_modeloptionalstringType of Controlnet
"sdxl_canny""sdxl_canny""sdxl_depth""sdxl_scribble""sdxl_softedge""sdxl_openpose"controlnet_scaleoptionalnumberControlnet Strength
0.9Range: 0 - 1guidance_scaleoptionalnumberScale for classifier-free guidance
6Range: 1 - 25negative_promptoptionalstringPrompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_stepsoptionalintegerNumber of denoising steps.
30Range: 10 - 100samplesoptionalintegerNumber of samples to generate.
1Range: 1 - 4scheduleroptionalstringType of scheduler.
"DPM2 Karras""DPM++ SDE Karras""DPM++ 2M Karras""DPM++ 2M SDE Karras""DPM++ 2M SDE Heun Karras""DPM++ 3M SDE Karras""LMS Karras""DPM2 Karras""DPM2 a Karras""DPM++ 2S a Karras""DPM++ 2M SDE Exponential"+19 moreseedoptionalintegerSeed for image generation.
-1Range: -1 - 999999999999999Response 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