POST
/
realtime
/
inpaint
Inpaint parts of an image (Real-Time)
curl --request POST \
  --url https://modelslab.com/api/v6/realtime/inpaint \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 512,
  "height": 512,
  "samples": 1,
  "safety_checker": false,
  "seed": 123,
  "instant_response": false,
  "base64": false,
  "webhook": "<string>",
  "track_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
}
Inpainting endpoint result
This API currently supports the following image formats: PNG and JPG.

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/realtime/inpaint' \

Body

json
{  
    "key": "your_api_key",  
    "prompt": "a cat sitting on a bench",  
    "negative_prompt": "bad quality",  
    "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,  
    "safety_checker": false,  
    "strength": 0.7,  
    "base64": false,  
    "seed": null,  
    "webhook": null,  
    "track_id": null
}

Body

application/json
init_image
string<uri>
required

Link to the initial image.

mask_image
string<uri>
required

Link to the mask image for inpainting.

key
string
required

Your API Key used for request authorization.

prompt
string
required

Text prompt with description of the things you want in the image to be generated.

strength
number

Prompt strength when using the initial image. 1.0 corresponds to full destruction of information in the init image.

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

Items you don't want in the image.

width
integer
default:512

Width of the generated image in pixels. Max: 1024.

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

Height of the generated image in pixels. Max: 1024.

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

Number of images to be returned in response. Maximum value is 4.

Required range: x <= 4
safety_checker
boolean
default:false

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

seed
integer | null

Seed is used to reproduce results; the same seed will give you the same image in return. Pass 'null' for a random number.

instant_response
boolean
default:false

Queue response instantly before processing finishes instead of waiting a minimum amount of time.

base64
boolean
default:false

Get response as base64 string.

webhook
string<uri>

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

track_id
string

This ID is returned in the response to the webhook API call and is used to identify the webhook request.

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.