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

~35.95s
~$0.01
 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

POSThttps://api.segmind.com/v1/models/inpaint-auto

Parameters

base_modelrequired
string

Type of SDXL Model

Default: "Real Vision XL"
Allowed values :
"Real Vision XL""SDXL""Juggernaut XL""DreamShaper XL"
cn_processorrequired
string

Preprocessor for controlnet

Default: "DPM++ 2M SDE Karras"
Allowed values (56 total):
"none""canny""depth""depth_leres""depth_leres++""hed""hed_safe""mediapipe_face""mlsd""normal_map"+46 more
imagerequired
string (base64)

Input Image.

promptrequired
string

Prompt to render

base64optional
boolean

Base64 encoding of the output image.

Default: false
cn_modeloptional
string

Type of Controlnet Model

Default: "Canny"
Allowed values :
"Canny""Depth""SoftEdge""Openpose"
guidance_scaleoptional
number

Scale for classifier-free guidance

Default: 7.5Range: 1 - 25
maskoptional
string (base64)

Mask Image

negative_promptoptional
string

Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'

num_inference_stepsoptional
integer

Number of denoising steps.

Default: 25Range: 20 - 100
samplesoptional
integer

Number of samples to generate.

Default: 1Range: 1 - 4
scheduleroptional
string

Type of scheduler.

Default: "DPM++ 2M SDE Karras"
Allowed values (29 total):
"DPM++ SDE Karras""DPM++ 2M Karras""DPM++ 2M SDE Exponential""DPM++ 2M SDE Karras""Euler a""Euler""Heun""LMS""DPM2""DPM2 a"+19 more
seedoptional
integer

Seed for image generation.

Default: -1Range: -1 - 999999999999999
strengthoptional
number

Scale for classifier-free guidance

Default: 7.5Range: 0 - 0.99

Response Type

Returns: Media File

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