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.
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.Region Endpoint 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 |
|---|---|---|---|
| Array[Object] | Yes | List of per-model rate limit items. The number of items must be 1 to 200. Example: |
| String | Yes | The model ID. Cannot be empty. Examples: |
| String | No | Operation type. Valid values:
Default value: |
| Number | No | Request count limit (QPM), non-negative. Maximum number of requests per minute, in requests/minute. Must be empty when |
| Number | No | Time period for the request rate limit, a positive integer in seconds. For example, |
| Number | No | Usage limit (TPM), non-negative. Maximum token usage per minute. Must be empty when |
| Number | No | Time period for the usage limit, a positive integer in seconds. For example, |
Response parameters
Parameter | Type | Description |
|---|---|---|
| String | The request ID. Example: |
| String | Error code. |
| String | Error message. |
| Boolean | Whether the call succeeded. Example: |
| Object | Business data. |
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.