Controlnet Inpainting
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/models/inpaint-auto"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "sample text",
12 "mask": "sample text",
13 "prompt": "sample text",
14 "negative_prompt": "sample text",
15 "samples": 1,
16 "base_model": "Real Vision XL",
17 "cn_model": "Canny",
18 "cn_processor": "DPM++ 2M SDE Karras",
19 "scheduler": "DPM++ 2M SDE Karras",
20 "num_inference_steps": 25,
21 "guidance_scale": 7.5,
22 "seed": -1,
23 "strength": 7.5,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text)
1import requests
2import json
3
4url = "https://api.segmind.com/v1/models/inpaint-auto"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "sample text",
12 "mask": "sample text",
13 "prompt": "sample text",
14 "negative_prompt": "sample text",
15 "samples": 1,
16 "base_model": "Real Vision XL",
17 "cn_model": "Canny",
18 "cn_processor": "DPM++ 2M SDE Karras",
19 "scheduler": "DPM++ 2M SDE Karras",
20 "num_inference_steps": 25,
21 "guidance_scale": 7.5,
22 "seed": -1,
23 "strength": 7.5,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text)
API Endpoint
https://api.segmind.com/v1/models/inpaint-auto
Parameters
base_model
requiredstring
Type of SDXL Model
"Real Vision XL"
"Real Vision XL"
"SDXL"
"Juggernaut XL"
"DreamShaper XL"
cn_processor
requiredstring
Preprocessor for controlnet
"DPM++ 2M SDE Karras"
"none"
"canny"
"depth"
"depth_leres"
"depth_leres++"
"hed"
"hed_safe"
"mediapipe_face"
"mlsd"
"normal_map"
+46 moreimage
requiredstring (base64)
Input Image.
prompt
requiredstring
Prompt to render
base64
optionalboolean
Base64 encoding of the output image.
false
cn_model
optionalstring
Type of Controlnet Model
"Canny"
"Canny"
"Depth"
"SoftEdge"
"Openpose"
guidance_scale
optionalnumber
Scale for classifier-free guidance
7.5
Range: 1 - 25mask
optionalstring (base64)
Mask Image
negative_prompt
optionalstring
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_steps
optionalinteger
Number of denoising steps.
25
Range: 20 - 100samples
optionalinteger
Number of samples to generate.
1
Range: 1 - 4scheduler
optionalstring
Type 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 moreseed
optionalinteger
Seed for image generation.
-1
Range: -1 - 999999999999999strength
optionalnumber
Scale for classifier-free guidance
7.5
Range: 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