tencent cloud

APIs

ChangeClothes

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-05-14 20:54:37

1. API Description

Domain name for API request: aiart.intl.tencentcloudapi.com.

This API is used to generate the images of the model changing clothes based on the model photo and the clothes image.
It supports 1 concurrency by default, which means that up to 1 submitted task can be processed simultaneously. Subsequent tasks can be processed only after ongoing ones are completed.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ChangeClothes.
Version Yes String Common Params. The value used for this API: 2022-12-29.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
ModelUrl Yes String URL of the model image.
Image restrictions: The single-edge resolution must be less than 3,000 and greater than 512, and the size after Base64 encoding must be less than 8 MB.
Input requirements:
1. It is recommended to input a frontal model image that at least fully shows the model's body (whole body, upper body or lower body) and avoids large-angle body deflections or complex poses.
2. It is recommended to input a 3:4 ratio image for better generation effect.
3. It is recommended to keep the category of the original clothes in the model image and the category of the replaced clothes the same, or to keep the original clothes' coverage on the model's body equal to or less than the replaced clothes'. (For example, if you need to change the model to wear shorts, the model in the original input image should also wear shorts instead of long pants.) Otherwise, the generation effect will be impaired.
ClothesUrl Yes String URL of the clothes image.
Image restrictions: single-side resolution less than 3000 and greater than 512, less than 8MB after conversion to Base64 string.
Input requirements:
It is recommended to input a complete front-facing flat image of the clothes, containing only one garment in the image. The type of the clothes supports Upper-body, Lower-body and Dress, and you can choose one from the three. The algorithm will change the model's clothes based on the input model image and the input clothes image.
ClothesType Yes String Type of the clothes, which needs to be consistent with the input clothes image.
Supported value:
Upper-body
Lower-body
Dress
LogoAdd No Integer Switch indicating whether to add a logo to the generated image. Default value: 1.
1: add logo
0: do not add logo
Other values: add logo
It is recommended to use an obvious logo to indicate that the image result is generated by AI.
LogoParam No LogoParam Logo content settings.
By default, the text "Generated by AI" is added to the bottom right corner of the generated image. You can also use other logo.
RspImgType No String Image return method (base64 or url).
You can specify only one method. Default value: base64.
The URL is valid for 1 hour.
It is recommended to choose url when the generated image resolution is large. Using base64 may cause return failure due to the image being too large.

3. Output Parameters

Parameter Name Type Description
ResultImage String Different content is returned depending on the input parameter RspImgType.
If the value is base64, the Base64 code of the generated image is returned.
If the value is url, the URL of the generated image is returned. The URL is valid for 1 hour. Save it in time.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Calling the API successfully

This example shows you how to call this API.

Input Example

POST / HTTP/1.1
Host: aiart.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ChangeClothes
<Common request parameters>

{
    "ModelUrl": "https://xxx.com/test.jpg",
    "ClothesUrl": "https://xxx.com/test.jpg",
    "ClothesType": "Upper-body",
    "RspImgType": "url"
}

Output Example

{
    "Response": {
        "RequestId": "0d0728ed-f777-4861-aa4b-5a6167daa0b6",
        "ResultImage": "https://result.jpg"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure.UnauthorizedOperation You have no permission to perform this operation. check your CAM policies to make sure that you have the corresponding CAM permissions.
FailedOperation.GenerateImageFailed The generated image failed the review. Please try again.
FailedOperation.ImageDecodeFailed Image decoding failed.
FailedOperation.ImageDownloadError Image download error.
FailedOperation.ImageResolutionExceed The image resolution is too high, which exceeds 2000×2000.
FailedOperation.ImageSizeExceed The size of the image after base64 encoding cannot exceed 10 MB.
FailedOperation.InnerError Internal service error. Please try again.
FailedOperation.RequestEntityTooLarge The entire request body (usually images) is too large .
FailedOperation.RequestTimeout The backend service timed out.
FailedOperation.RpcFail RPC request failed, typically due to algorithm service malfunction.
FailedOperation.ServerError Internal service error.
FailedOperation.Unknown Unknown error.
InvalidParameter.InvalidParameter Invalid parameters.
InvalidParameterValue.ImageEmpty No image is input.
InvalidParameterValue.ParameterValueError Parameter or value is invalid.
InvalidParameterValue.StyleConflict 1xx styles cannot be used together with other styles.
InvalidParameterValue.TextLengthExceed The input text is too long. Use a shorter one and try again.
InvalidParameterValue.UrlIllegal The URL format is invalid.
OperationDenied.ImageIllegalDetected The image failed the review because it contains illegal information.
OperationDenied.TextIllegalDetected The text failed the review because it contains illegal information.
RequestLimitExceeded Too frequent requests
RequestLimitExceeded.JobNumExceed Too many tasks are being processed simultaneously. Please try again later.
ResourceUnavailable.Delivering The resource is being delivered.
ResourceUnavailable.InArrears The account is in arrears.
ResourceUnavailable.LowBalance Insufficient balance.
ResourceUnavailable.NotExist The billing status is unknown. Check whether the service has been activated in the console.
ResourceUnavailable.StopUsing Services for the account has been stopped.
ResourcesSoldOut.ChargeStatusException The billing status is abnormal.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック