Base URLs:
POST
/v3/async/replace-object
Replace unwanted objects, defects, people to target as your wish. The returned images can be access by https://novita.ai/reference/task/task.htmlopen in new window endpoint with parameter 'task_id'.
Request header parameters
Authorization string Required
In Bearer {{Key}} format.
Content-Type string Required
Only application/json supported
Request Body parameters
image_file string Required
The base64 of original image, with a maximum resolution of 16 megapixels and a max file size of 30 Mb.
prompt string Required
Positive prompt word, length [1, 512], divided by ,
extra object
Extra info.
negative_prompt string Required
Negtive prompt word, length [0, 512], divided by ,
object_prompt string Required
The prompt of the object to be replaced, used to specify the object, length [1, 512], divided by ,
curl -- location 'https://api.novita.ai/v3/async/replace-object' -- header 'Authorization: Bearer {{Key}}' -- header 'Content-Type: application/json' -- data '{
'image_file' : '{{base64 encoded image}}' ,
'prompt' : 'a dog' ,
'extra' : {
'response_image_type' : 'png' ,
'enterprise_plan' : {
'enabled' : false
}
} ,
'negative_prompt' : 'ng_deepnegative_v1_75t, (badhandv4:1.2), (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, ((monochrome)), ((grayscale)) watermark, moles' ,
'object_prompt' : '1girl'
} '
{
'task_id' : 'df7c6754-7b5b-48d6-9757-be14003edb07'
}
This API helps to replace unwanted objects, defects, people to target as your wish.
Please set the Content-Type
header to application/json
in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported .
Try it in playgroundopen in new window .
Request:
curl --location --request POST 'https://api.novita.ai/v3/async/replace-object' \
--header 'Authorization: Bearer {{key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"negative_prompt": "ng_deepnegative_v1_75t, (badhandv4:1.2), (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, ((monochrome)), ((grayscale)) watermark, moles",
"prompt": "a dog",
"object_prompt": "1girl",
"image_file": "{{Base64 encoded image}}"
}'
Response:
{
"task_id" : "d4b2b68f-fd45-41b7-a095-a563e9d3405f"
}
Use task_id
to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs.image_url
of response.
Request:
curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id=d4b2b68f-fd45-41b7-a095-a563e9d3405f' \
--header 'Authorization: Bearer {{key}}'
Response:
{
"task" : {
"task_id" : "d4b2b68f-fd45-41b7-a095-a563e9d3405f" ,
"status" : "TASK_STATUS_SUCCEED" ,
"reason" : ""
} ,
"images" : [
{
"image_url" : "https://faas-output-image.s3.*****" ,
"image_url_ttl" : "3600" ,
"image_type" : "jpeg"
}
]
}