This topic answers frequently asked questions about image APIs, including debugging, billing, rate limiting, and common API errors.
The image models covered in this topic include Wan text-to-image V2, person instance segmentation, and image erase completion.
Debug APIs locally
Image APIs support HTTP calls. The following section uses the Wan text-to-image API as an example to show how to debug an HTTP API call locally.
Activate the model service and obtain an API key. Then, set the API key as an environment variable.
Find the
curlcommand in the image API documentation.
If you use macOS or Linux, execute the curl command in the terminal.
If you use Windows, use an API platform such as Postman or Apifox to send HTTP requests.
Note: When you use an API platform to send a request, you must replace$DASHSCOPE_API_KEYin the curl commandBearer $DASHSCOPE_API_KEYwith your actual API key, for example,Bearer sk-xxxxxx.
Billing and rate limiting
Billing example
Note: Image Model 1 and Image Model 2 in the table are examples only and are not real model names.
Model | Free quota (View) | Unit price | Rate limit (shared by Alibaba Cloud account and RAM users) | |
QPS limit for task submission | Number of concurrent tasks | |||
Image Model 1 | 500 images | Free for a limited time | 2 | 1 |
Image Model 2 | 500 images | $0.02/image | 2 | 1 |
Free quota
Description: The free quota is based on the number of images that are successfully generated by the model. Input images or failed model processing will not consume the quota.
How to get: The free quota is automatically granted after you activate the Alibaba Cloud Model Studio service and is valid for 90 days.
Usage: An Alibaba Cloud account and its RAM users share the free quota.
For more information, see Free quota for new users.
Free for a limited time
If the billing method is "Free for a limited time", the model is in public preview. You cannot use the model after the free quota is exhausted.
Billing description
If a specific unit price is provided, such as $0.02/image, the model is commercialized. You are charged for using the model after your free quota is exhausted or expires.
Billable item: You are charged only for successfully generated output images. No fees are charged in other cases.
Billing method: Fees are charged to your Alibaba Cloud account. RAM users cannot be independently metered or billed. All usage is charged to the Alibaba Cloud account that owns the RAM users. To view your billing information, go to the Billing Overview page in the Alibaba Cloud Management Console.
Top-up method: You can add funds to your account on the Expenses and Costs page in the Alibaba Cloud Management Console.
Model call statistics: To view the model call volume and count, go to the Model Observation (Singapore or Beijing) page on the Alibaba Cloud Model Studio platform.
For more information about billing, see Billable items.
Rate limiting
Description: An Alibaba Cloud account and its RAM users share the rate limits.
API errors
Image download failed
Scenario: When you use your own image URL (not the example URL from the documentation) to request an API, the error message "Reference image download failed, please check image url." is returned.
{
"request_id": "657f0d1b-76d0-9e3e-b6d6-xxxxxx",
"output": {
"task_id": "5e6fa974-9a25-4271-8659-xxxxxx",
"task_status": "FAILED",
"code": "BadRequest.InputDownloadFailed",
"message": "Reference image download failed, please check image url."
}
}Possible cause: The input image URL is incorrect, inaccessible, or has restricted download permissions. This prevents the model service from successfully downloading the image.
Solution: Ensure that the image URL is complete and allows public network access. You can upload the image to a self-managed storage service that is publicly accessible or to a cloud storage service such as OSS. Make sure that the image URL allows public network access.
The curl command for the task creation API fails
Scenario: You copy the curl command for a task creation API from the documentation and an error occurs when you execute it. The following curl command for the image background generation model is used as an example.
The error message "Required body invalid, please check the request body format." is returned.
{
"request_id": "d306ae65-3f6d-9d6c-acfb-xxxxxx",
"code": "InvalidParameter",
"message": "Required body invalid, please check the request body format."
}Possible cause: The request body of the task creation API contains Chinese characters. If the client that executes the curl command does not support parsing Chinese characters, the request body may not be parsed correctly, which causes the error.
Solution: If you use macOS or Linux, execute the curl command directly in the terminal. If you use Windows, use an HTTP API platform such as Postman or Apifox to send the request.
Resource download timeout when calling APIs from outside China
Scenario: When you call an API from outside China and the image resources are stored in a region outside the Chinese mainland, a resource download timeout error is likely to occur. The error message is as follows:
Download the media resource timed out during the data inspection processPrimary cause: Network instability between regions outside the Chinese mainland and the service endpoint can cause a timeout when the service attempts to download images.
Solution: Store the image resources in a region within the Chinese mainland and configure acceleration. Note that you cannot configure the image download timeout period for an Alibaba Cloud account.
Other questions
Configure a domain name whitelist to access image OSS links
Images generated by image models are stored in Alibaba Cloud OSS. Each image is assigned an OSS link, such as https://dashscope-result-xx.oss-cn-xxxx.aliyuncs.com/xxx.png. The image OSS link allows public access. You can use this link to view or download the image.
If your business has high security requirements and your internal network cannot access Alibaba Cloud OSS links, you must configure a whitelist for external network access. Add the following domain names to the whitelist to ensure that you can access the image links.
# List of image OSS domain names
dashscope-result-bj.oss-cn-beijing.aliyuncs.com
dashscope-result-hz.oss-cn-hangzhou.aliyuncs.com
dashscope-result-sh.oss-cn-shanghai.aliyuncs.com
dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com
dashscope-result-zjk.oss-cn-zhangjiakou.aliyuncs.com
dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com
dashscope-result-hy.oss-cn-heyuan.aliyuncs.com
dashscope-result-cd.oss-cn-chengdu.aliyuncs.com
dashscope-result-gz.oss-cn-guangzhou.aliyuncs.com