QueryModelUsageInfo

Updated at:

Queries the number of invoked models, total number of calls, and consumed points by business type, statistical window, and model type.

Operation description

Prerequisites

The caller must have the RAM permissions for the corresponding API operation. The query scope is limited to the model usage of the specified business for the current account. The returned results depend on the generated statistical data and do not indicate that every call is counted in real time.

Time and missing data

Time boundaries are uniformly based on Asia/Shanghai (UTC+8). For a custom range, set StatDateType to 1d and specify both StartDate and EndDate. The range includes both the start and end dates, and the maximum span is 90 days. If statistical data is unavailable for some dates, only the existing data within the range is aggregated.

If no statistical results are available for 24h or 1d queries without specified dates, the summary API returns zero values and the list API returns an empty list. This does not mean that no actual calls were made. If no statistical results are available for other windows or custom date ranges, metrics or lists may be empty. Do not treat empty values as zeros.

Combined calls

You can call QueryModelUsageInfo to obtain summary metrics and QueryModelUsageList to obtain model details. Both API operations can be called independently. When comparing summary and detail data, BizType, StatDateType, StartDate, EndDate, and ModelType must be consistent. Keyword applies only to the detail API. Details filtered by keywords cannot be directly compared with unfiltered summary results.

Request example combinations

In the parameter table, StatDateType=1d, StartDate=2026-08-01, and EndDate=2026-08-07 indicate querying the cumulative usage from August 1 to August 7, 2026 (inclusive), in the Asia/Shanghai (UTC+8) time zone. To query the last 7 days, change the value to StatDateType=1w and omit both date parameters.

The number of calls, points, and model information in the examples are used to illustrate field meanings. They do not represent the actual usage of the current account and do not constitute a commitment to model specifications or pricing. The actual usage and available model information are subject to the API response.

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

appstreaming:QueryModelUsageInfo

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

BizType

integer

Yes

The business type. This parameter is required and has no default value. The mapping between business types and values is as follows:

  • 1: Enterprise Edition.

  • 10: Personal Edition.

  • 20: Commercial Edition.

  • 70: Agentic Computer.

The API directly queries the model usage of the current account based on the specified BizType and does not automatically convert or replace the business type. To query the usage of the Agentic Computer business, you must explicitly set BizType to 70. The usage of different business types is calculated separately.

1

StatDateType

string

Yes

The statistical window. This parameter is required, has no default value, is case-sensitive, and does not support leading or trailing spaces. Time boundaries are calculated based on Asia/Shanghai (UTC+8).

  • 24h: The last 24 hours up to the most recent available statistical cutoff time. The cutoff time corresponds to the current hour or the previous hour.

  • 1d: If the start and end dates are not specified, the cumulative usage for today is queried. If both StartDate and EndDate are specified, the specified calendar day range is queried.

  • 1w: The last 7 days up to the day of the request. If the statistical results for the current day are unavailable, the results from the previous day are not used.

  • 30d: The last 30 days up to the day of the request. If the statistical results for the current day are unavailable, the results from the previous day are not used.

  • 1y: The statistical results for the last 365 days. If the results for the current year are unavailable, the statistical results for the previous year may be returned, and the actual coverage may be earlier than the day of the request. This API does not return the statistical cutoff time for this result, so you cannot use it to confirm whether the data has been updated to the current day.

Only 1d supports custom date ranges. Do not specify start and end dates for other windows.

Valid values:

  • 1d :

    Today or custom date range.

  • 24h :

    Last 24 hours.

  • 1w :

    Last 7 days.

  • 30d :

    Last 30 days.

  • 1y :

    Last 365 days.

1d

StartDate

string

No

The start date of the custom query. The format is yyyy-MM-dd. The date is interpreted as a calendar day in the Asia/Shanghai (UTC+8) time zone and includes the current day. The value is a date string and does not include hours, minutes, seconds, or a time zone suffix.

This parameter can be specified only when StatDateType is set to 1d, and it must be specified or omitted together with EndDate. The start date cannot be later than the end date. The total number of days, including the start and end dates, must be between 1 and 90. If both parameters are omitted, the cumulative usage for today is queried. If you do not use a custom date, omit these two parameters directly. Do not pass empty strings or blank spaces.

2026-08-01

EndDate

string

No

The end date of the custom query. The format is yyyy-MM-dd. The date is interpreted as a calendar day in the Asia/Shanghai (UTC+8) time zone and includes the current day. The value is a date string and does not include hours, minutes, seconds, or a time zone suffix.

This parameter can be specified only when StatDateType is set to 1d, and it must be specified or omitted together with StartDate. The end date cannot be earlier than the start date. The total number of days, including the start and end dates, cannot exceed 90. If you do not use a custom date, omit these two parameters directly. Do not pass empty strings or blank spaces.

2026-08-07

ModelType

string

No

The model type filter. If this parameter is not specified or an empty string is passed, no filtering by type is performed. The value is case-insensitive:

  • LLM: Large language model.

  • IMAGE: Image model.

  • VIDEO: Video model.

  • AUDIO: Audio model.

  • EMBEDDING: Embedding model.

Non-empty values do not support leading or trailing spaces. Other non-empty values will cause parameter validation to fail.

Valid values:

  • IMAGE :

    Image model.

  • EMBEDDING :

    Embedding model.

  • VIDEO :

    Video model.

  • LLM :

    Large language model.

  • AUDIO :

    Audio model.

LLM

Response elements

Element

Type

Description

Example

object

The API response.

Data

object

The model usage summary for the selected business, statistical window, and model type. If no statistical results are available for 24h or 1d queries without specified start and end dates, each metric returns 0. If no statistical results are available for other windows or custom date ranges, no valid metric values are provided. In this case, do not treat the usage as zero.

{"ActiveModelCount":10,"CallCount":13280,"PointsConsumption":120}

ActiveModelCount

integer

The number of distinct models that have been called at least once within the query range. Unit: models. The value is deduplicated by model code. It may not be equal to the TotalCount of the model usage list, which may also include models that have not been called within the current query range.

10

CallCount

integer

The total number of model calls within the query range. Unit: calls. This includes both successful and failed calls.

13280

PointsConsumption

number

The actual points consumed within the query range. Unit: points. The returned value can be displayed directly without further conversion.

120

RequestId

string

The unique identifier of the request, which is used to locate and troubleshoot request issues.

1CBAFFAB-B697-4049-A9B1-67E1FC5F****

Examples

Success response

JSON format

{
  "Data": {
    "ActiveModelCount": 10,
    "CallCount": 13280,
    "PointsConsumption": 120
  },
  "RequestId": "1CBAFFAB-B697-4049-A9B1-67E1FC5F****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.