Skip to main content
Model Management

Update model rate limits

Calls the POST /api/v1/models/limits endpoint to update the rate limit quotas (QPM/TPM) of models in a specified workspace. Both merge overlay and delete rate limit operations are supported.

Prerequisites

An API key has been created and configured as the environment variable DASHSCOPE_API_KEY. For more information, see Configure an API key in environment variables.

Request

  • HTTP method: POST
  • Request URL Replace {WorkspaceId} with your workspace ID.
    RegionEndpoint
    China (Beijing)https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/models/limits
  • Authentication Set Authorization: Bearer {API_KEY} in the request header.

Request parameters

All parameters are passed through the request body.

Parameter

Type

Required

Description

models

Array[Object]

Yes

List of per-model rate limit items. The number of items must be 1 to 200. Example: [{"model":"qwen-plus","request_limit":60}]

models[].model

String

Yes

The model ID. Cannot be empty. Examples: qwen-plus, qwen3.7-plus.

models[].operation_type

String

No

Operation type. Valid values:

  • OVERLAY: Merge overlay. Only the passed fields are overridden; fields not passed are backfilled with their current values.

  • DELETE: Delete the rate limit. All rate limit value fields must be empty.

Default value: OVERLAY.

models[].request_limit

Number

No

Request count limit (QPM), non-negative. Maximum number of requests per minute, in requests/minute. Must be empty when operation_type=DELETE. Default value: null (no change). Example: 60.

models[].request_limit_period

Number

No

Time period for the request rate limit, a positive integer in seconds. For example, 60 = 1 minute. Default value: null (no change).

models[].usage_limit

Number

No

Usage limit (TPM), non-negative. Maximum token usage per minute. Must be empty when operation_type=DELETE. Default value: null (no change). Example: 100000.

models[].usage_limit_period

Number

No

Time period for the usage limit, a positive integer in seconds. For example, 60 = 1 minute. Default value: null (no change).

Response parameters

Parameter

Type

Description

request_id

String

The request ID. Example: d5f5201f-ee7a-9e3d-8569-bc0eedec21f9.

code

String

Error code. null on success.

message

String

Error message. null on success.

success

Boolean

Whether the call succeeded. Example: true.

output

Object

Business data. null for this endpoint.

TPM exemption scenario

To limit only RPM and exempt TPM, first call this endpoint with {"model":"X","operation_type":"DELETE"} to delete all rate limits for the target model. Then pass {"model":"X","operation_type":"OVERLAY","request_limit":60,"request_limit_period":60} to set only the QPM. The two steps are not atomic, so there is a brief window without any limit in between.

Sample requests

Example 1: Set QPM=60 and TPM=100000
curl -X POST "https://dashscope.aliyuncs.com/api/v1/models/limits" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
        "models": [
            {
                "model": "qwen-plus",
                "operation_type": "OVERLAY",
                "request_limit": 60,
                "request_limit_period": 60,
                "usage_limit": 100000,
                "usage_limit_period": 60
            }
        ]
    }'
Example 2: Delete rate limits
curl -X POST "https://dashscope.aliyuncs.com/api/v1/models/limits" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
        "models": [
            {"model": "qwen-plus", "operation_type": "DELETE"}
        ]
    }'

Sample response

Success example
{
    "code": null,
    "message": null,
    "success": true,
    "output": null,
    "request_id": "d5f5201f-ee7a-9e3d-8569-bc0eedec21f9"
}
Failure example
{
    "code": "InvalidParameter",
    "message": "Cannot set TPM without QPM for model qwen-plus: no existing QPM limit, please set QPM first",
    "success": false,
    "output": null,
    "request_id": "d5f5201f-ee7a-9e3d-8569-bc0eedec21f9"
}

Error codes

If the call fails, an error message is returned. For more information about error codes and solutions, see Error messages.
Text Generation
Image Generation
Video Generation
World models
3D Model Generation
Audio
  • Audio generation
Realtime API
Text Embedding
Decision Model
TokenPlan
Model Production