Usage API
v0.6.0+ 用量查詢端點,支援
period=YYYY-MM
端點總覽
| 方法 | 路徑 | 說明 |
|---|---|---|
| GET | /api/v1/usage/user/summary | 查詢用戶各功能總用量 |
| GET | /api/v1/usage/devices/{deviceId} | 查詢設備各功能用量 |
1) 查詢用戶用量摘要
GET /api/v1/usage/user/summary?period=2026-02
響應重點
analysis: 秒數用量alert: 告警次數用量attribute: 屬性偵測用量vlm: token 用量
{
"success": true,
"data": {
"userId": "user-uuid",
"period": "2026-02",
"analysis": {
"used": 3600,
"limit": 72000,
"balance": 68400,
"isExceeded": false
},
"alert": {
"used": 350,
"limit": 10000,
"balance": 9650,
"isExceeded": false
},
"attribute": {
"used": 120,
"limit": 5000,
"balance": 4880,
"isExceeded": false
},
"vlm": {
"used": 85000,
"limit": 10000000,
"balance": 9915000,
"isExceeded": false
}
}
}
2) 查詢設備用量
GET /api/v1/usage/devices/{deviceId}?period=2026-02
響應重點
- 設備層級
quotaSeconds / usedSeconds / remainingSeconds - 各功能子配額:
alertQuota / attributeQuota / vlmQuota isDisabled/isUnlimited/usagePercentage
錯誤回應
| HTTP 狀態 | 說明 |
|---|---|
| 404 | 設備不存在或不屬於當前用戶 |
使用建議
- 儀表板首頁顯示 user summary。
- 設備詳情頁顯示 device usage。
- 若要看趨勢與對比,改用 Billing Dashboard API。