POST
/
inpaint
Inpaint parts of an image
curl --request POST \
  --url https://modelslab.com/api/v6/images/inpaint \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 512,
  "height": 512,
  "samples": 1,
  "num_inference_steps": 31,
  "safety_checker": false,
  "safety_checker_type": "sensitive_content_text",
  "seed": 123,
  "guidance_scale": 7.5,
  "use_karras_sigmas": true,
  "algorithm_type": "none",
  "vae": "<string>",
  "lora_strength": "<string>",
  "lora_model": "<string>",
  "clip_skip": 2,
  "base64": false,
  "temp": false,
  "webhook": "<string>",
  "track_id": "<string>",
  "ip_adapter_id": "ip-adapter_sdxl",
  "ip_adapter_scale": 0.5,
  "ip_adapter_image": "<string>",
  "scheduler": "DDPMScheduler",
  "model_id": "<string>",
  "init_image": "<string>",
  "mask_image": "<string>",
  "strength": 0.5
}'
{
  "status": "success",
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "meta": {},
  "nsfw_content_detected": true,
  "webhook_status": "<string>",
  "tip": "<string>"
}
Inpainting endpoint result
You can find a list of the public models available and their IDs here

Request

Make a POST request to below endpoint and pass the required parameters as a request body.
curl
--request POST 'https://modelslab.com/api/v6/images/inpaint' \

Body

json
{  
    "key": "your_api_key",  
    "model_id": "lazymixv4-inpaint",  
    "prompt": "a cat sitting on a bench",  
    "negative_prompt": null,  
    "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",  
    "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",  
    "width": "512",  
    "height": "512",  
    "samples": "1",  
    "steps": "21",  
    "safety_checker": "no",  
    "guidance_scale": 7.5,  
    "strength": 0.7,  
    "scheduler": "UniPCMultistepScheduler",  
    "lora_model": null,  
    "use_karras_sigmas": "yes",  
    "vae": null,  
    "lora_strength": null,  
    "seed": null,  
    "webhook": null,  
    "track_id": null
} 

Body

application/json
model_id
string
required

The ID of the model to be used. It can be a public model or one you have trained.

init_image
string<uri>
required

URL of the initial image.

mask_image
string<uri>
required

URL of the mask image for inpainting.

key
string
required

Your API Key used for request authorization.

strength
number

Prompt strength when using the initial image. Range from 0 to 1.

Required range: 0 <= x <= 1
prompt
string

A text description of what you want in the generated image.

negative_prompt
string

Items you don't want in the image.

width
integer
default:512

The width of the image in pixels.

Required range: x <= 1024
height
integer
default:512

The height of the image in pixels.

Required range: x <= 1024
samples
integer
default:1

The number of images to be returned in response. Maximum is 4.

Required range: x <= 4
num_inference_steps
integer
default:31

The number of denoising steps. Values range from 1 to 20, and any value above 20 will be capped at 20.

Required range: 1 <= x <= 20
safety_checker
boolean
default:false

A checker for NSFW images. If detected, such images will be replaced by a blank image.

safety_checker_type
enum<string>
default:sensitive_content_text

How to modify the image if NSFW content is found.

Available options:
blur,
sensitive_content_text,
pixelate,
black
seed
integer | null

Seed for reproducible results. The same seed generates the same image. Pass null for a random number.

guidance_scale
number
default:7.5

Scale for classifier-free guidance.

Required range: 1 <= x <= 20
use_karras_sigmas
boolean
default:true

Use Karras sigmas to generate images. Produces nice results.

algorithm_type
enum<string>
default:none

Used in DPMSolverMultistepScheduler scheduler.

Available options:
none,
dpmsolver+++
vae
string | null

Use a custom VAE for generating images. Default is null.

lora_strength
string

Strength of the LoRa model(s). If multiple LoRa models, provide comma-separated values (0.1 to 1).

lora_model
string

LoRa model ID(s). Multiple LoRa models are supported; pass comma-separated values (e.g., 'contrast-fix,yae-miko-genshin').

clip_skip
integer
default:2

Number of CLIP layers to skip.

Required range: 1 <= x <= 8
base64
boolean
default:false

If true, response output is base64 string. Input images can also be base64.

temp
boolean
default:false

If true, stores image in temporary storage (cleaned every 24 hours).

webhook
string<uri>

URL to receive a POST API call once image generation is complete.

track_id
string

Unique ID used in webhook response to identify the request.

ip_adapter_id
enum<string>

IP adapter ID.

Available options:
ip-adapter_sdxl,
ip-adapter_sd15,
ip-adapter-plus-face_sd15,
ip-adapter-plus_sdxl_vit-h,
ip-adapter-plus-face_sdxl_vit-h
ip_adapter_scale
number

Scale for the IP adapter (0 to 1).

Required range: 0 <= x <= 1
ip_adapter_image
string<uri>

Valid image URL for IP adapter.

scheduler
enum<string>

Available schedulers for image generation.

Available options:
DDPMScheduler,
DDIMScheduler,
PNDMScheduler,
LMSDiscreteScheduler,
EulerDiscreteScheduler,
EulerAncestralDiscreteScheduler,
DPMSolverMultistepScheduler,
HeunDiscreteScheduler,
KDPM2DiscreteScheduler,
DPMSolverSinglestepScheduler,
KDPM2AncestralDiscreteScheduler,
UniPCMultistepScheduler,
DDIMInverseScheduler,
DEISMultistepScheduler,
IPNDMScheduler,
KarrasVeScheduler,
ScoreSdeVeScheduler,
LCMScheduler

Response

Inpainting generation response

status
enum<string>

Status of the image generation.

Available options:
success
generationTime
number

Time taken to generate the image in seconds.

id
integer

Unique identifier for the image generation request.

output
string<uri>[]

Array of generated image URLs.

Array of proxy image URLs.

meta
object

Metadata about the image generation including all parameters used.

nsfw_content_detected
boolean

Indicates if NSFW content was detected in the generated image.

webhook_status
string

Status of the webhook notification.

tip
string

Additional information or tips for the user.