Help Center/ MaaS/ API Reference/ MaaS Call Statistics/ Obtaining Total Statistics
Updated on 2026-07-03 GMT+08:00

Obtaining Total Statistics

Function

Used to query the aggregated call data of real-time inference services, including: total calls, total failed calls, total tokens, input tokens, output tokens, etc. Data is retained for 30 days only.

Constraints

  • Region restrictions: Only the CN-Hong Kong region is supported.
  • API rate limiting: The total number of requests for this API from all users cannot exceed 1,000 within one minute.
  • User request limit: The number of requests for this API from a single user cannot exceed 200 within one minute.
  • Rate-limiting response: When the rate limit is exceeded, the API returns the HTTP status code 429 "Too Many Requests".
  • Retry suggestion: If the rate limit is exceeded, wait 60 seconds and try again.

URI

POST /v1/{project_id}/maas/monitoring/show-statistics

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID and Name.

Constraints: N/A

Range: The value can contain 32 characters. Only lowercase letters and digits are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details, see Authentication.

Constraints: N/A

Range: N/A

Default Value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

service_type

Yes

Integer

Definition: Service type.

Constraints: N/A

Range:

Default Value: N/A

api_keys

No

Array of strings

Definition: API key tag list, which is used for filtering.

MaaS services support API key calls.

Go to the API key management page to get the API key tag. The Tag field in the API key list shows the API key tag.

Constraints: N/A

Range:

  • Example for obtaining the online experience call data: api_keys: [""].
  • When obtaining the call data of some API keys, transfer the tags of the corresponding API keys. Example: api_keys: ["test01","test02"].
  • Example for obtaining the call data of online experience and some API keys: api_keys: ["test01", "test02", ""].
  • When obtaining all call data, do not use this parameter.

Default Value: N/A

ips

No

Array of strings

Definition: IP address list, which indicates the source IP addresses of the clients that have been called. If this parameter is not specified, all IP addresses are queried. To query the IP address, you can call the API for obtaining the IP address list.

Constraints: The value must be in the IP address format.

Range: N/A

Default Value: N/A

start_time

Yes

Long

Definition: Timestamp of the start time, in milliseconds.

Constraints: The end time must be within 30 days from the start time.

Range: The value must be greater than 0 and no greater than the value of end_time.

Default Value: N/A

end_time

Yes

Long

Definition: Timestamp of the end time, in milliseconds.

Constraints: The end time must be within 30 days from the start time.

Range: The value must be greater than 0.

Default Value: N/A

timezone

No

String

Definition: Time zone.

Constraints: N/A

Range: The value must comply with the IANA time zone specifications, such as Asia/Shanghai and UTC.

Default Value: Asia/Shanghai (GMT+8)

infer_type

Yes

String

Definition: Service inference type.

Range:

  • real_time: real-time inference
  • batch: batch inference (Batch inference is under restricted use. To use it, submit a service ticket.)

Constraints: N/A

Default Value: N/A

model_type

No

string

Definition: Model type.

Range:

  • Text Generation: text generation model
  • Video Generation: video generation model
  • Image Generation: image generation model
  • Vector Model: text vectorization
  • Embedding: embedding model
  • Image Understanding: image understanding model
  • Rerank: reranking model

Constraints: N/A

Default Value: Text Generation

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_request_count

Integer

Definition: Total number of calls.

Range: N/A

total_error_count

Integer

Definition: Total number of failed calls.

Range: N/A

total_token

Double

Definition: Total number of called tokens. If batch inference is used, this parameter indicates the total number of inference tokens. However, batch inference is under restricted use. To use it, submit a service ticket.

Range: N/A

total_prompt_token

Double

Definition: Total number of input tokens.

Range: N/A

total_completion_token

Double

Definition: Total number of output tokens.

Range: N/A

total_completion_tasks

Integer

Definition: Number of completed batch inference tasks. (This parameter is related to batch inference. However, batch inference is under restricted use. To use it, submit a service ticket.)

Range: N/A

total_infer_count

Integer

Definition: Total number of inference times, that is, the total number of service inference times. (This parameter is related to batch inference. However, batch inference is under restricted use. To use it, submit a service ticket.)

Range: N/A

video_generate_duration

Double

Definition: Total duration of the generated video.

Range: N/A

image_generate_nums

Integer

Definition: Total number of generated images.

Range: N/A

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, which identifies the error type. For details, see MaaS Error Codes.

Range: N/A

error_msg

String

Definition: Error description. For details, see MaaS Error Codes.

Range: N/A

Request Example

Query the calling statistics of a user-defined endpoint service whose real-time inference time ranges from 1761753600000 to 1761806407404.

/v1/{{project_id}}/maas/monitoring/show-statistics

{
  "service_type" : 4,
  "start_time" : 1761753600000,
  "end_time" : 1761806407404,
  "timezone" : "Asia/Shanghai",
  "infer_type" : "real_time"
}

Response Example

Status code: 200

Success response

{
  "total_request_count" : 202,
  "total_error_count" : 6,
  "total_token" : 78.035,
  "total_prompt_token" : 70.265,
  "total_completion_token" : 7.77,
  "total_completion_tasks" : 0,
  "total_infer_count" : 0,
  "video_generate_duration": 0,
  "image_generate_nums": 0
}

Status code: 400

Failure response

{
  "error_code" : "ModelArts.0104",
  "error_msg" : "Invalid parameter. Issue: The end time cannot be earlier than the start time."
}

Status Codes

Status Code

Description

200

Success response.

400

Failure response.

Error Codes

For details, see Error Codes.