curl --request POST \
--url https://api.novita.ai/v3/async/inpainting \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '{
"extra": {
"response_image_type": "<string>",
"webhook": {
"url": "<string>",
"test_mode": {
"enabled": true,
"return_task_status": "<string>"
}
},
"custom_storage": {
"aws_s3": {
"region": "<string>",
"bucket": "<string>",
"path": "<string>",
"save_to_path_directly": true
}
},
"enterprise_plan": {
"enabled": true
},
"enable_nsfw_detection": true,
"nsfw_detection_level": 123
},
"request": {
"model_name": "<string>",
"image_base64": "<string>",
"mask_image_base64": "<string>",
"prompt": "<string>",
"image_num": 123,
"steps": 123,
"guidance_scale": {},
"sampler_name": "<string>",
"mask_blur": 123,
"negative_prompt": "<string>",
"sd_vae": "<string>",
"seed": 123,
"loras": [
{
"model_name": "<string>",
"strength": {}
}
],
"embeddings": [
{
"model_name": "<string>"
}
],
"clip_skip": 123,
"strength": {},
"inpainting_full_res": 123,
"inpainting_full_res_padding": 123,
"inpainting_mask_invert": 123,
"initial_noise_multiplier": {}
}
}'
{
"task_id": "<string>"
}
curl --request POST \
--url https://api.novita.ai/v3/async/inpainting \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '{
"extra": {
"response_image_type": "<string>",
"webhook": {
"url": "<string>",
"test_mode": {
"enabled": true,
"return_task_status": "<string>"
}
},
"custom_storage": {
"aws_s3": {
"region": "<string>",
"bucket": "<string>",
"path": "<string>",
"save_to_path_directly": true
}
},
"enterprise_plan": {
"enabled": true
},
"enable_nsfw_detection": true,
"nsfw_detection_level": 123
},
"request": {
"model_name": "<string>",
"image_base64": "<string>",
"mask_image_base64": "<string>",
"prompt": "<string>",
"image_num": 123,
"steps": 123,
"guidance_scale": {},
"sampler_name": "<string>",
"mask_blur": 123,
"negative_prompt": "<string>",
"sd_vae": "<string>",
"seed": 123,
"loras": [
{
"model_name": "<string>",
"strength": {}
}
],
"embeddings": [
{
"model_name": "<string>"
}
],
"clip_skip": 123,
"strength": {},
"inpainting_full_res": 123,
"inpainting_full_res_padding": 123,
"inpainting_mask_invert": 123,
"initial_noise_multiplier": {}
}
}'
{
"task_id": "<string>"
}
This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the image generation results.
application/json
Show properties
png
, webp
, jpeg
Show properties
Show properties
TASK_STATUS_SUCCEED
, TASK_STATUS_FAILED
Show properties
Show properties
Show properties
0
, 1
, 2
Hide properties
,
. Range [1, 1024].Euler a
, Euler
, LMS
, Heun
, DPM2
, DPM2 a
, DPM++ 2S a
, DPM++ 2M
, DPM++ SDE
, DPM fast
, DPM adaptive
, LMS Karras
, DPM2 Karras
, DPM2 a Karras
, DPM++ 2S a Karras
, DPM++ 2M Karras
, DPM++ SDE Karras
, DDIM
, PLMS
, UniPC
,
. Range [1, 1024].Show properties
Show properties
strength
indicates the degree to which the reference image_base64
should be transformed. Must be between 0 and 1. image_base64
will be used as a starting point, with increasing levels of noise added as the strength value increases. The number of denoising steps depends on the amount of noise initially added. When strength
is 1, added noise will be maximum and the denoising process will run for the full number of iterations specified in steps
. A value of 1, therefore, essentially ignores image_base64
.0
, 1
0
, 1
mask
images. How do I generate mask
parameters in the body?mask
images to base64?import base64
# mask files path
filename_input = "mask_edited.png"
# read mask file
with open(filename_input, "rb") as f:
base64_pic = base64.b64encode(f.read()).decode("utf-8")
# write mask file
with open("input.txt", "w") as f:
f.write(base64_pic)
Content-Type
header to application/json
in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
"model_name":"realisticVisionV40_v40VAE-inpainting_81543.safetensors"
in body represent inpainting models, which, can be accessed in API /v3/model with sd_name
like %inpainting%.
Request:
curl --location --request POST 'http://api.novita.ai/v3/async/inpainting' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API Key}}' \
--data-raw '{
"extra": {
"response_image_type": "jpeg"
},
"request": {
"model_name": "realisticVisionV40_v40VAE-inpainting_81543.safetensors",
"prompt": "Leonardo DiCaprio",
"negative_prompt": "(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime), text, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, BadDream, UnrealisticDream",
"image_num": 1,
"steps": 25,
"seed": -1,
"clip_skip": 1,
"guidance_scale": 7.5,
"sampler_name": "Euler a",
"mask_blur": 1,
"inpainting_full_res": 1,
"inpainting_full_res_padding": 32,
"inpainting_mask_invert": 0,
"initial_noise_multiplier": 1,
"strength": 0.85,
"image_base64": "{{base64 encoded image}}",
"mask_image_base64": "{{base64 encoded mask image}}"
}
}'
Response:
{
"code": 0,
"msg": "",
"data": {
"task_id": "270f4fba-2cb0-4a56-8b82-xxxx"
}
}
````"model_name":"realisticVisionV40_v40VAE-inpainting_81543.safetensors"` in body represent inpainting models, which, can be accessed in API /v3/model with `sd_name` like %inpainting%.
`Request:`
```bash
curl --location --request POST 'http://api.novita.ai/v3/async/inpainting' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API Key}}' \
--data-raw '{
"extra": {
"response_image_type": "jpeg"
},
"request": {
"model_name": "realisticVisionV40_v40VAE-inpainting_81543.safetensors",
"prompt": "Leonardo DiCaprio",
"negative_prompt": "(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime), text, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, BadDream, UnrealisticDream",
"image_num": 1,
"steps": 25,
"seed": -1,
"clip_skip": 1,
"guidance_scale": 7.5,
"sampler_name": "Euler a",
"mask_blur": 1,
"inpainting_full_res": 1,
"inpainting_full_res_padding": 32,
"inpainting_mask_invert": 0,
"initial_noise_multiplier": 1,
"strength": 0.85,
"image_base64": "{{base64 encoded image}}",
"mask_image_base64": "{{base64 encoded mask image}}"
}
}'
Response:
{
"code": 0,
"msg": "",
"data": {
"task_id": "270f4fba-2cb0-4a56-8b82-xxxx"
}
}
Was this page helpful?