Get usage trends¶
Get the current user’s call, token, and cost metrics over time.
GET https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/trend
Before you begin¶
Prepare a personal access token. For creation and management, see Manage personal access tokens.
Results are scoped to data accessible to the current user.
Query parameters¶
Replace $MOI_PERSONAL_ACCESS_TOKEN in the example with your personal access token.
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/trend" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN" \
--data-urlencode "granularity=day"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
No |
Start time in nonnegative Unix seconds; must not exceed |
|
integer |
No |
End time in nonnegative Unix seconds. |
|
string |
No |
Catalog model object ID. |
|
string |
No |
Model type. |
|
string |
No |
Model name submitted in the inference request. |
|
string |
No |
Call status, such as |
|
string |
No |
Call error category. |
|
string |
No |
Caller IP address. |
|
string |
No |
TaaS local token key ID. |
|
string |
No |
TaaS local key IDs; repeat the parameter or comma-separate values. |
|
string |
Required with |
Credential type: |
|
string |
Required with |
Credential object ID; requires |
|
string |
No |
Billing usage-event ID. |
|
string |
No |
Billing record ID. |
|
string |
No |
Pricing mode. |
|
string |
No |
Settlement method: genesis or |
|
string |
No |
Enterprise plan ID. |
|
string |
No |
Enterprise contract number. |
|
string |
No |
Enterprise plan model ID. |
|
string |
No |
Responses response ID. |
|
string |
No |
Conversation ID. |
|
string |
No |
Usage log IDs; repeat the parameter or comma-separate values. |
|
string |
No |
Alias for ids; values are combined. |
|
string |
No |
Provider ID; results remain scoped to the current user. |
|
string |
No |
Bucket granularity: |
Successful response¶
Returns HTTP 200 with call statistics grouped into time buckets.
{
"points": [
{
"timestamp": 1788710400,
"time": "2026-09-07T00:00:00Z",
"calls": 2,
"total_calls": 2,
"input_tokens": 12,
"output_tokens": 8,
"total_input_tokens": 12,
"total_output_tokens": 8,
"total_user_tokens": 20,
"cache_read_tokens": 0,
"cache_creation_tokens": 0,
"total_cost": "0.0001",
"total_channel_cost": "0.00005",
"total_channel_tokens": 20,
"total_cache_read_tokens": 0,
"total_cache_creation_tokens": 0
}
],
"granularity": "day",
"start_time": 1788710400,
"end_time": 1788796799,
"truncated": false
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Buckets with data, ordered by time; empty buckets are not filled. |
|
integer |
Bucket start in Unix seconds. |
|
string |
Bucket start in UTC, RFC 3339 format. |
|
integer |
Call count in this bucket. |
|
integer |
Alias of calls. |
|
integer |
Input tokens. |
|
integer |
Output tokens. |
|
integer |
Alias of |
|
integer |
Alias of |
|
integer |
Sum of input, output, cache-read, and cache-creation tokens. |
|
integer |
Total cache-read tokens. |
|
integer |
Total cache-creation tokens. |
|
string |
Total call cost as a decimal string. |
|
string |
Total cost of associated upstream requests. |
|
integer |
Input, output, and cache tokens across associated upstream requests. |
|
integer |
Alias of |
|
integer |
Alias of |
|
string |
Requested bucket granularity. |
|
integer |
Effective range start, Unix seconds. |
|
integer |
Effective range end, Unix seconds. |
|
boolean |
True when an omitted start or a range exceeding 999 intervals shortens the range. |
In field paths, [] denotes each array item.
An omitted or future end time is limited to the current time. When the range exceeds the limit, the most recent interval is retained.
Error response¶
{
"code": 400,
"message": "start_time must be a non-negative unix timestamp"
}
Field |
Type |
Description |
|---|---|---|
|
integer |
HTTP error status. |
|
string |
Error description. |