Common questions about image APIs in Alibaba Cloud Model Studio, covering debugging, billing, rate limits, and API errors.
Debugging
How do I debug image API calls locally?
Image APIs use standard HTTP. This example uses the Wan text-to-image API with curl.
- Activate the model service and get an API key, then set it as an environment variable.
- Find the
curlcommand in the API documentation. For example:
Example: curl command for text-to-image
Example: curl command for text-to-image
- On macOS or Linux, run the command directly in a terminal.
- On Windows, use an API platform such as Postman or Apifox to send the HTTP request.
Note: When using an API platform, replace$DASHSCOPE_API_KEYin theAuthorizationheader with your actual API key, for example,Bearer sk-xxxxxx.
Billing and rate limits
How does billing work for image models?
Each image model has a free quota and may have a per-image price:
| Model | Free quota | Unit price | 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 |
What does "free for a limited time" mean?
The model is in public preview. After the free quota is exhausted, the model becomes unavailable.
What counts as a billable image?
Only successfully generated images are billed. Input images and failed requests do not consume quota or incur charges.
How do I get the free quota?
Free quota is granted automatically when you activate Model Studio. It is valid for 90 days and shared across the account and all RAM users.
For details, see Free quota for new users.
When do paid charges start?
Models with a specific unit price (for example, $0.02/image) are commercialized. Charges begin after the free quota is exhausted or expires.
Fees are billed to the Alibaba Cloud account -- all usage rolls up to the parent account.
- View bills: Go to the Billing Overview page in the Alibaba Cloud Management Console.
- Add funds: Go to the Expenses and Costs page.
- Monitor usage: Check the Monitoring page on the Model Studio platform (Singapore | Beijing).
API errors
Common image API errors and solutions:
| Error code | Message | Typical cause |
|---|---|---|
BadRequest.InputDownloadFailed | Reference image download failed | Image URL is incorrect, unreachable, or access-restricted |
InvalidParameter | url error, please check url | The model parameter is set to a text generation model name instead of an image generation model name |
InvalidParameter | Required body invalid | Request body contains Chinese characters that the client cannot parse |
| (Timeout) | Download the media resource timed out | Network instability between regions outside the Chinese mainland and the service endpoint |
BadRequest.InputDownloadFailed: "Reference image download failed"
InvalidParameter: "url error"
model parameter does not match the endpoint being called. The image synthesis endpoint (/api/v1/services/aigc/text2image/image-synthesis) accepts only image generation model names. A text generation model name such as qwen-turbo is rejected with url error, even when the request URL is correct. In OpenAI-compatible mode, a text generation model name returns an empty response instead.
Solution: Set model to an image generation model name such as wanx2.1-t2i-turbo and call the endpoint asynchronously.
Example: curl command for image generation
Example: curl command for image generation
task_id. Poll GET /api/v1/tasks/{task_id} until task_status becomes SUCCEEDED to get the URL of the generated image.
InvalidParameter: "Required body invalid"
curl request body contains Chinese characters that the client cannot parse.
Solution: On macOS or Linux, run curl directly in a terminal (handles UTF-8 natively). On Windows, use an API platform like Postman or Apifox.
Example: curl command for image background generation
Example: curl command for image background generation