Tra cứu thống kê hóa đơn Tra cứu mức dùng, số lần gọi và tiêu thụ mô hình theo đơn vị thời gian.
Tổng hợp mức dùng, thời lượng, số lần gọi và số tiền theo đơn vị thời gian. tokenName/modelName lọc thêm bản ghi. Thành công nhưng không khớp trả data là mảng rỗng.
token <token>
Token xác thực hóa đơn được gửi trong Header token, không có Bearer. Try It nhận token truy cập hệ thống tạo trong cài đặt cá nhân rồi tự lấy thông tin hóa đơn; ví dụ mã có đầy đủ quy trình.
Vị trí truyền: header
Định nghĩa kiểu TypeScript
Sử dụng kiểu request body trong TypeScript.
Sao chépSao chép kiểu TS của phản hồi
cURL
JavaScript
Go
Python
Java
C#
Rustset -euo pipefail
ACCESS_TOKEN='your-user-token'
BILLING_TOKEN=$(curl --fail --silent --show-error "https://api.agtcloud.cn/api/user/self" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" | \
jq -er '
select(.success == true)
| .data.remark | fromjson | .token
| select(type == "string" or type == "number")
| tostring | select(length > 0)
')
curl --fail-with-body "https://api.agtcloud.cn/bill/stats" \
-X POST \
-H "token: ${BILLING_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{
"type": 3,
"startTime": 1791561600,
"endTime": 1792511999
}' 200
Ví dụ thống kê theo ngày, nội dung chỉ để minh họa.
{
"message": "SUCCESS",
"code": 200,
"data": [
{
"siteUrl": null,
"time": "2026-10-20 00:00:00",
"timeGroup": 1792425600,
"userName": "example-user",
"tokenName": "example-key",
"modelName": "MODEL_ID",
"modelLabel": null,
"providerName": null,
"channelGroup": null,
"totalPromptTokens": 8927,
"totalCompletionTokens": 143,
"totalCacheTokens": 0,
"totalCacheCreationTokens": 0,
"totalCacheCreationHourToken": null,
"totalImageInput": 0,
"totalImageOutput": 0,
"totalAudioInput": 0,
"totalUseTime": 6,
"callCount": 1,
"totalAmount": 0.012588,
"discount": null,
"actualAmount": null
}
],
"timestamp": 1792537200000
}