ModelRouterQueryCostTrendMetrics

更新时间:
复制 MD 格式

billing management / Cost trends

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

aicontent:ModelRouterQueryCostTrendMetrics

list

*All Resource

*

None None

Request syntax

GET /api/v1/modelRouter/open/billing/cost/trend HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

startTime

integer

Yes

The start time of the query, specified as a Unix timestamp in seconds.

1700000000

endTime

integer

Yes

The end time of the query, specified as a Unix timestamp in seconds.

1700086400

modelTypes

string

No

The model types to query, separated by commas.

LLM,VL

clientId

integer

No

Filters the results by department ID.

1

granularity

string

No

The granularity of the data. Valid values: hourly and daily. Default: hourly.

hourly

maxResults

integer

No

The maximum number of results to return per page.

10

nextToken

string

No

The pagination token from a previous response to retrieve the next page of results. If this parameter is omitted, the first page of results is returned.

xxxx-xxx-xxxxx

Response elements

Element

Type

Description

Example

object

The response body.

{ "success": true, "data": {"default_metric": "total_amount", "granularity": "hourly", "metrics": [], "points": []}, "requestId": "592A27EF-26D3-1434-98C1-97AD63337852" }

requestId

string

The unique request ID. If you encounter a problem, provide this ID to technical support for troubleshooting.

xxxx-xxxx-xxxx-xxxxxxxx

success

boolean

Indicates whether the request was successful. A value of true indicates success, and false indicates failure.

true

errCode

string

The error code returned when the request fails.

UNKNOWN_ERROR

errMessage

string

The error message returned when the request fails.

未知错误

httpStatusCode

integer

The HTTP status code.

200

data CostQueryTrendDTO

The data object containing the cost trend metrics.

[]

maxResults

integer

The maximum number of results returned per page.

10

nextToken

string

A token to retrieve the next page of results. If no token is returned, all results have been retrieved.

xxxx-xxx-xxxxx

Examples

Success response

JSON format

{
  "requestId": "xxxx-xxxx-xxxx-xxxxxxxx",
  "success": true,
  "errCode": "UNKNOWN_ERROR",
  "errMessage": "未知错误",
  "httpStatusCode": 200,
  "data": {
    "defaultMetric": "total_amount",
    "granularity": "hourly",
    "metrics": [
      {
        "key": "total_calls",
        "label": "调用次数",
        "sortable": true,
        "unit": "次"
      }
    ],
    "points": [
      {
        "timestamp": 1700000000,
        "values": "\"{\\\"total_calls\\\":0,\\\"video_duration\\\":0,\\\"total_amount\\\":0,\\\"model_count\\\":0,\\\"image_count\\\":0}\""
      }
    ]
  },
  "maxResults": 10,
  "nextToken": "xxxx-xxx-xxxxx"
}

Error codes

HTTP status code

Error code

Error message

Description

500 Server.Internal.UnknownError The request processing has failed due to some unknown error.
403 B.Permission.DeniedException 鉴权失败或权限不足
403 B.Permission.OrgNoExistException 组织不存在,请主账号开通权限后再试,或联系管理员

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.