GetGatewayQuotaRuleSubjectUsage

Updated at:

Queries the usage details of a consumer under a gateway quota rate-limiting rule, including used quota, total quota, whether the limit is exceeded, usage details, and consumption records.

Operation description

Retrieves the usage details of a specific consumer under a quota rule. This operation applies only to AI gateways whose version is later than 2.1.19.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

apig:GetGatewayQuotaRuleSubjectUsage

none

*Gateway

acs:apig:{#regionId}:{#accountId}:gateway/{#GatewayId}

None None

Request syntax

GET /v1/gateways/{gatewayId}/quota-rules/{ruleId}/subjects/{subjectId}/usage HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

gatewayId

string

No

The gateway ID.

gw-123456

ruleId

string

No

The rule ID.

qr-d8j7fpmm1hks65kxxxxx

subjectId

string

No

The subject (consumer) ID.

cs-d8kkaium1xxxxxxxxxxx

Request parameters

Parameter

Type

Required

Description

Example

pageNumber

integer

No

The page number for the consumption records of the consumer within the current cycle.

1

pageSize

integer

No

The number of consumption records per page for the consumer within the current cycle. Maximum value: 10.

10

Response elements

Element

Type

Description

Example

object

The response body.

requestId

string

The request ID.

1234567890

code

string

The status code.

200

message

string

The response message.

success

data

object

The response data.

{"usedAmount":500}

usedAmount

integer

The total used amount of the subject.

500

totalQuota

integer

The total quota of the subject.

1000

overLimit

boolean

Indicates whether the quota limit is exceeded.

false

inputAmount

integer

The total input token consumption.

300

outputAmount

integer

The total output token consumption.

180

cachedAmount

integer

The total cached token consumption.

20

details

object

The paginated consumption details.

{"totalSize":100}

totalSize

integer

100

pageNumber

integer

1

pageSize

integer

10

items

array<object>

[{"model":"qwen-plus",'usedAmount':210}]

object

{'model':'qwen-plus','usedAmount':210}

model

string

qwen-plus

inputAmount

integer

120

outputAmount

integer

80

cachedAmount

integer

10

usedAmount

integer

210

startTime

string

2026-06-05 13:16:31

Examples

Success response

JSON format

{
  "requestId": "1234567890",
  "code": "200",
  "message": "success",
  "data": {
    "usedAmount": 500,
    "totalQuota": 1000,
    "overLimit": false,
    "inputAmount": 300,
    "outputAmount": 180,
    "cachedAmount": 20,
    "details": {
      "totalSize": 100,
      "pageNumber": 1,
      "pageSize": 10,
      "items": [
        {
          "model": "qwen-plus",
          "inputAmount": 120,
          "outputAmount": 80,
          "cachedAmount": 10,
          "usedAmount": 210,
          "startTime": "2026-06-05 13:16:31"
        }
      ]
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.