List AI service usage¶
List AI service usage and rating results for the current account, with service-slot and billing-scenario filters.
GET https://billing.moi.matrixorigin.cn/api/v1/billing/usage
Before you begin¶
Prepare a valid personal access token for the account owner.
Call List current accounts to obtain the target account’s ID.
Query parameters¶
Replace $MOI_PERSONAL_ACCESS_TOKEN and $ACCOUNT_ID in the example with your personal access token and the selected account’s ID.
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/usage?account_id=$ACCOUNT_ID&page_size=2" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Target account ID from |
|
string |
No |
Only |
|
string |
No |
Filter by the service slot recorded in usage. |
|
string |
No |
Filter by the billing scenario recorded in usage. |
|
string |
No |
Filter by usage-event workspace. |
|
string |
No |
Filter by rated record status, falling back to usage event status before rating. |
|
string |
No |
Inclusive start by usage event creation time, in RFC 3339 format. |
|
string |
No |
Exclusive end by usage event creation time, in RFC 3339 format. |
|
integer |
No |
Page size, 1–100; omitted, nonpositive, or greater than 100 uses 50. |
|
string |
No |
Next-page token. Omit initially; then use |
Successful response¶
Returns HTTP 200 with AI service usage matching the filters; the list is empty when no records match.
{
"items": [],
"total": 0,
"as_of": 1788739200
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Records returned by this request. |
|
string |
Rated usage record ID, returned after rating. |
|
string |
Usage event ID. |
|
string |
Billing account ID. |
|
string |
Service category name. |
|
string |
Service slot recorded by the usage source. |
|
string |
Billing scenario recorded by the usage source. |
|
string |
Meter code, |
|
string |
Usage quantity as a decimal string. |
|
string |
Usage unit. |
|
string |
Unit price in Credit, when rating is available. |
|
string |
Net charge in Credit, when rating is available. |
|
string |
Record status, preferring the rated record status. |
|
string |
Time when the usage occurred. |
|
string |
Source request ID; may be omitted. |
|
integer |
Source request count; may be omitted. |
|
integer |
Creation time in Unix seconds. |
|
integer |
Total records matching the filters. |
|
string |
Next-page token; stop when omitted or empty. |
|
integer |
Time the query result was generated, in Unix seconds. |
In field paths, [] denotes each array item. For example, items[].rated_record_id refers to the corresponding field in each item.
For the next page, set $NEXT_PAGE_TOKEN to next_cursor from the preceding response and retain the same filters. Stop when the token is omitted or empty.
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/usage?account_id=$ACCOUNT_ID&page_size=2&page_token=$NEXT_PAGE_TOKEN" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
Error response¶
Missing authentication returns HTTP 401; provide a valid personal access token.
{
"code": "unauthenticated",
"message": "missing bearer token",
"error": "missing bearer token"
}
Field |
Type |
Description |
|---|---|---|
|
string |
Error code. |
|
string |
Error message. |
|
string |
Compatibility error message, with the same content as message. |