Skip to main content
Billing

GetBillingTrend

Queries billing trend information for a specified time range, with support for daily or monthly aggregation, grouping by dimensions, and filtering.

Request syntax

GET /modelstudio/billing/trend HTTP/1.1

Request parameters

Name

Type

Required

Description

Example

granularity

string

Yes

Query granularity. This field is required. Valid values:

  • MONTH: monthly

  • DAY: daily

DAY

timePeriod

object

Yes

Query time range, including start and end times. This field is required.

timePeriod.start

string

Yes

Start time in YYYY-MM-DD format.

2026-08-01

timePeriod.end

string

Yes

End time in YYYY-MM-DD format.

2026-08-31

groupBy

array<object>

Yes

Grouping condition. Exactly one element must be specified. See the supplementary notes below for supported dimension codes.

groupBy.code

string

Yes

Dimension code.

MAAS_TYPE

filter

object

No

Dimension filter conditions.

filter.dimensions

array<object>

No

List of filter dimensions.

filter.dimensions.code

string

No

Dimension code.

BASE_MODEL

filter.dimensions.values

array<string>

No

List of filter values.

["qwen-max"]

filter.dimensions.selectType

string

No

Filter type. Valid values:

  • IN

  • NOT

IN

topNum

integer

No

Number of groups to return. Valid range: 1 to 20. Default value: 20. Remaining groups are merged into "Other".

20

zeroFilter

boolean

No

Whether to filter out groups with zero amount. Default value: true.

true

regionId

string

No

Region ID.

cn-beijing

locale

string

No

Response language. Default value: en-US. Valid values:

  • en-US: English

  • zh-CN: Chinese

zh-CN

Supplementary notes The following values are supported for groupBy[].code and filter.dimensions[].code. We recommend using uppercase consistently:

Dimension code

Description

Valid filter.dimensions[].values

MAAS_TYPE

MaaS business type

inference (model inference), training (model training), model_units (model units), capacity_reserved (reserved capacity)

BASE_MODEL

Base model

Original base model values from billing data, such as qwen-plus

API_KEY_ID

API Key ID

Original API Key ID values from billing data

WORKSPACE_ID

Workspace ID

Original Workspace ID values from billing data

FEE_TYPE

Fee type

billing (billing fees), subscription (subscription fees)

CHARGE_TYPE

Billing method

postpaid (pay-as-you-go), prepaid (subscription)

BUSINESS_REGION

Business region

cn-beijing, ap-southeast-1, cn-hongkong, etc. Values are based on actual data

SERVICE_SITE

Service site

asia-pacific-china, global, international, etc. Values are based on actual data

ARTICLE_CODE

Article code

sfm_inferenceglobal_public_intl, etc. Values are based on actual data

You can pass DIMENSION_FILTER_NULL_VALUE in filter.dimensions[].values for any dimension to match records where the field is NULL or an empty string.

Response parameters

Name

Type

Description

Example

requestId

string

Request ID.

099A671E-FA21-5A36-8A73-918572DDEF53

code

string

Response code.

200

message

string

Response message.

null

success

boolean

Whether the request was successful.

true

data

object

Response data.

data.costTotals

object

Total cost for the entire query time range, including TopN and "Other".

data.costTotals.amount

string

Total cost amount.

100

data.costTotals.pretaxAmount

string

Amount excluding tax.

94.34

data.costTotals.taxAmount

string

Tax amount.

5.66

data.costTotals.currency

string

Amount currency.

CNY

data.groupByTotal

array<object>

Total cost for TopN groups and the optional "Other" group within the period.

data.groupByTotal.key

string

Group dimension value.

qwen-plus

data.groupByTotal.name

string

Group display name, affected by the locale parameter.

qwen-plus

data.groupByTotal.amount

string

Total amount for this group.

60

data.groupByTotal.pretaxAmount

string

Amount excluding tax for this group.

56.60

data.groupByTotal.taxAmount

string

Tax amount for this group.

3.40

data.resultByTime

array<object>

Cost trend list sorted by time in ascending order.

data.resultByTime.period

string

Statistical period. DAY returns yyyyMMdd, MONTH returns yyyyMM.

20260801

data.resultByTime.total

object

Total cost for the current period.

data.resultByTime.total.amount

string

Total cost amount for the current period.

30

data.resultByTime.total.pretaxAmount

string

Amount excluding tax for the current period.

28.30

data.resultByTime.total.taxAmount

string

Tax amount for the current period.

1.70

data.resultByTime.total.currency

string

Amount currency for the current period.

CNY

data.resultByTime.periodDetails

array<object>

Cost groups that actually exist in the current period.

data.resultByTime.periodDetails.key

string

Group dimension value. Data outside TopN uses DIMENSION_GROUP_OTHERS_VALUE.

qwen-plus

data.resultByTime.periodDetails.name

string

Group display name, affected by the locale parameter.

qwen-plus

data.resultByTime.periodDetails.amount

string

Amount for this group in the current period.

20

data.resultByTime.periodDetails.pretaxAmount

string

Amount excluding tax for this group in the current period.

18.87

data.resultByTime.periodDetails.taxAmount

string

Tax amount for this group in the current period.

1.13

data.resultByTime.periodDetails.percentage

string

Ratio of this group's amount to the total amount of the current period.

0.6667

Examples

Sample success response JSON format
{
  "requestId": "099A671E-FA21-5A36-8A73-918572DDEF53",
  "code": "200",
  "message": "null",
  "success": true,
  "data": {
    "costTotals": {
      "amount": "100",
      "pretaxAmount": "94.34",
      "taxAmount": "5.66",
      "currency": "CNY"
    },
    "groupByTotal": [
      {
        "key": "qwen-plus",
        "name": "qwen-plus",
        "amount": "60",
        "pretaxAmount": "56.60",
        "taxAmount": "3.40"
      }
    ],
    "resultByTime": [
      {
        "period": "20260801",
        "total": {
          "amount": "30",
          "pretaxAmount": "28.30",
          "taxAmount": "1.70",
          "currency": "CNY"
        },
        "periodDetails": [
          {
            "key": "qwen-plus",
            "name": "qwen-plus",
            "amount": "20",
            "pretaxAmount": "18.87",
            "taxAmount": "1.13",
            "percentage": "0.6667"
          }
        ]
      }
    ]
  }
}
Text Generation
Image Generation
  • FAQ
Video Generation
World models
Audio
  • Audio generation
Realtime API
Text Embedding
TokenPlan
Model Production