List request logs¶
List the current user’s model calls, token usage, and billing reporting results.
GET https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs
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" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN" \
--data-urlencode "page_size=2"
Save the returned next_page_token as $NEXT_PAGE_TOKEN, retain the same filters, and request the next page. Stop when this value is empty or omitted.
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN" \
--data-urlencode "page_size=2" \
--data-urlencode "page_token=$NEXT_PAGE_TOKEN"
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. |
|
integer |
No |
Page size; default 100, maximum 1000. |
|
string |
No |
Next-page token from the previous response; omit for the first request. |
Successful response¶
Returns HTTP 200 with the current page of request logs and pagination information.
{
"items": [
{
"id": "usage_example",
"user_id": "user_example",
"model_id": "model_example",
"model_name": "example-chat-model",
"requested_model": "example-chat-model",
"called_at": 1788710400,
"input_tokens": 12,
"output_tokens": 8,
"cache_read_tokens": 0,
"cache_creation_tokens": 0,
"cost": "0.0001",
"status": "success",
"latency_ms": 120,
"request_body_ref_id": "body_request_example",
"response_body_ref_id": "body_response_example",
"request_body_sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
"response_body_sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
"request_body_bytes": 2,
"response_body_bytes": 2,
"created_at": 1788710400,
"credential": {
"type": "personal_access_token",
"id": "credential_example"
}
}
],
"total": 1,
"next_page_token": ""
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Records on this page. |
|
string |
Usage log ID. |
|
string |
TaaS local key ID, for calls using that credential type. |
|
string |
TaaS local key name. |
|
string |
Calling user ID. |
|
string |
Calling user name, when available. |
|
string |
Catalog model object ID. |
|
string |
Actual model name. |
|
string |
Model name submitted in the request. |
|
string |
Caller IP. |
|
integer |
Call time, Unix seconds. |
|
integer |
Input tokens. |
|
integer |
Output tokens. |
|
integer |
Cache-read tokens. |
|
integer |
Cache-creation tokens. |
|
string |
Call cost as a decimal string. |
|
string |
Call result status. |
|
string |
Call error category, when present. |
|
string |
Call error description, when present. |
|
integer |
Call |
|
string |
Archive reference ID for the request body. Returned when populated. |
|
string |
Archive reference ID for the response body. Returned when populated. |
|
string |
SHA-256 of the full request body. Returned when populated. |
|
string |
SHA-256 of the full response body. Returned when populated. |
|
string |
Request tracing ID. Returned when populated. |
|
string |
Key-hash prefix. Returned when populated. |
|
string |
Billing meter code. Returned when populated. |
|
string |
Call pricing mode. Returned when populated. |
|
string |
Enterprise plan ID. Returned when populated. |
|
string |
Enterprise plan name. Returned when populated. |
|
string |
Enterprise contract number. Returned when populated. |
|
string |
Enterprise plan model ID. Returned when populated. |
|
string |
Serialized pricing snapshot. Returned when populated. |
|
string |
Settlement method. Returned when populated. |
|
string |
Usage reporting status. Returned when populated. |
|
string |
Usage reporting group ID. Returned when populated. |
|
string |
Idempotency key for the billing usage event. Returned when populated. |
|
string |
Billing usage-event ID. Returned when populated. |
|
string |
Billing record ID. Returned when populated. |
|
string |
Billing account ID. Returned when populated. |
|
string |
Credit amount rated for this call. Returned when populated. |
|
string |
Credit balance recorded from the reporting result. Returned when populated. |
|
string |
Available credit recorded from the reporting result. Returned when populated. |
|
string |
Latest billing usage-reporting error. Returned when populated. |
|
integer |
Full request body size in bytes. |
|
integer |
Full response body size in bytes. |
|
integer |
Billing reporting time, Unix seconds, when present. |
|
integer |
Billing reporting attempts. |
|
integer |
Log creation time, Unix seconds. |
|
object |
Credential identity for this call, when recorded. |
|
string |
Credential type: |
|
string |
Credential object ID. |
|
string |
Service account ID; returned for service-account credentials. |
|
integer |
Total records matching the filters. |
|
string |
Next-page token; empty or omitted on the last page. |
In field paths, [] denotes each array item.
Error response¶
{
"code": 400,
"message": "page_size must be an integer between 1 and 1000"
}
Field |
Type |
Description |
|---|---|---|
|
integer |
HTTP error status. |
|
string |
Error description. |
Next steps¶
Use an item’s id to Get request log details.