Controlnet Inpainting Serverless API
This model is capable of generating photo-realistic images given any text input, with the extra capability of inpainting and controlling the pictures by using a mask
1import requests
2import json
3
4url = "https://api.segmind.com/v1/inpaint-auto"
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/outputs/inpaint_auto.jpeg",
12 "prompt": "woman in space suit , underwater, full body, floating in water, air bubbles, detailed eyes, deep sea in background, water surface, god ray, fish",
13 "negative_prompt": "disfigured, deformed, ugly",
14 "samples": 1,
15 "base_model": "SDXL",
16 "cn_model": "Depth",
17 "cn_processor": "DPM++ 2M SDE Karras",
18 "scheduler": "DPM++ 2M SDE Karras",
19 "num_inference_steps": 25,
20 "guidance_scale": 7,
21 "seed": 12467,
22 "strength": 0.9,
23 "base64": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29 result = response.json()
30 print(json.dumps(result, indent=2))
31else:
32 print(f"Error: {response.status_code}")
33 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/inpaint-auto"
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/outputs/inpaint_auto.jpeg",
12 "prompt": "woman in space suit , underwater, full body, floating in water, air bubbles, detailed eyes, deep sea in background, water surface, god ray, fish",
13 "negative_prompt": "disfigured, deformed, ugly",
14 "samples": 1,
15 "base_model": "SDXL",
16 "cn_model": "Depth",
17 "cn_processor": "DPM++ 2M SDE Karras",
18 "scheduler": "DPM++ 2M SDE Karras",
19 "num_inference_steps": 25,
20 "guidance_scale": 7,
21 "seed": 12467,
22 "strength": 0.9,
23 "base64": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29 result = response.json()
30 print(json.dumps(result, indent=2))
31else:
32 print(f"Error: {response.status_code}")
33 print(response.text)API Endpoint
https://api.segmind.com/v1/inpaint-autoParameters
base_modelrequiredstringType of SDXL Model
"Real Vision XL""Real Vision XL""SDXL""Juggernaut XL""DreamShaper XL"cn_processorrequiredstringPreprocessor for controlnet
"DPM++ 2M SDE Karras""none""canny""depth""depth_leres""depth_leres++""hed""hed_safe""mediapipe_face""mlsd""normal_map"+46 moreimagerequiredstring (uri)Input Image.
promptrequiredstringPrompt to render
base64optionalbooleanBase64 encoding of the output image.
falsecn_modeloptionalstringType of Controlnet Model
"Canny""Canny""Depth""SoftEdge""Openpose"guidance_scaleoptionalnumberScale for classifier-free guidance
7.5Range: 1 - 25maskoptionalstring (uri)Mask Image
negative_promptoptionalstringPrompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_stepsoptionalintegerNumber of denoising steps.
25Range: 20 - 100samplesoptionalintegerNumber of samples to generate.
1Range: 1 - 4scheduleroptionalstringType of scheduler.
"DPM++ 2M SDE Karras""DPM++ SDE Karras""DPM++ 2M Karras""DPM++ 2M SDE Exponential""DPM++ 2M SDE Karras""Euler a""Euler""Heun""LMS""DPM2""DPM2 a"+19 moreseedoptionalintegerSeed for image generation.
-1Range: -1 - 999999999999999strengthoptionalnumberScale for classifier-free guidance
7.5Range: 0 - 0.99Response Type
Returns: Media File
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