Background Diffusion

Get API Key

Async API

Background Diffusion api will automatically perform AI expansion on the transparent area of ​​the input image, based on the input prompt text. Due to the long call time of this interface, Background Diffusion api consists of two interfaces: one for submitting tasks and one for querying results

Submit task API

Request

API url: https://www.cutout.pro/api/v1/paintAsync

Method: POST

Content-Type: application/json

Header paramters

  • APIKEY:The user's API key, which is available in the user center

Body paramters:

{
    imgUrl (string, optional): The url of the input image. At least one of imgUrl and imgbase64 must have a value
    imgBase64 (string, optional): The base64 encode string of the image. At least one of imgUrl and imgbase64 must have a value
    text (string, optional): The description you want to generate the background of the image
}

Response

{
  "code": 0,
  "data": 12345, //The task id returned
  "msg": null,
  "time": 1599644436677
}

Query result API

Request

API url: https://www.cutout.pro/api/v1/getPaintResult Method: GET

Header paramters

  • APIKEY:The user's API key, which is available in the user center

Query String parameters:

  • taskId The returned task id of the submit request

Response

{
    "code": 0,
    "data": {
                "id": 375593109065861,
                "createdAt": 1673833938000,
                "url": "https://xxxx", The temp url of the input image saved by cutout.pro just for logging purposes only. It will be deleted after a few moments
                "text": "a beautiful young woman standing on a city street, with a bright smile",
                "quantity": 1,
                "resultList": [
                    {
                        "id": 372497201555428,
                        "batchId": 375593109065861,
                        "status": 1, //0:processing, 1: success, 2: failed,3: waiting
                        "result": "https://xxxx", //The result image url
                        "preview": "https://xxxx", //The preview image url, which size is smaller for preview 
                        "width": 800, //The image width
                        "height": 800, // The image height
                        "waitNumber": 0, // If the value of waitNumber is greater than 0, it means the server is busy, this task is queued. It is the queue number of the task.
                        "percentage": 100 //If the status is 0 processing, represents the percentage progress of image processing
                    }
                ]
    },
    "msg": "",
    "time": 1674007505348
}

Price

resolution of width*heightprice
Less equal than 512x512Each successful API call costs 3 credits
Between 512x512(exclude) and 1024x1024(include)Each successful API call costs 6 credits
Between 1024x1024(exclude) and 1920x1080(include)Each successful API call costs 12 credits