mirror of
https://github.com/zgs225/cliproxy-plugin-commandcode.git
synced 2026-09-26 03:32:50 +08:00
feat: derive monthly (billing period) usage window
- Add FetchUsageSummaryRaw calling /internal/usage/summary which returns billing-period totals (periodBasis=billing-period) - Derive monthly window: used=totalMonthlyCredits, cap=totalMonthlyCredits + monthlyCredits remaining (≈ plan monthly total), remaining=monthlyCredits - Add monthly card to quota resource page (HTML + JS rendering) - Skip monthly card when summary unavailable
This commit is contained in:
@@ -256,8 +256,20 @@ type UsageWindowLimitData struct {
|
||||
ResetInSeconds int64 `json:"reset_in_seconds"`
|
||||
}
|
||||
|
||||
// UpstreamUsageSummaryResponse reflects Command Code's /internal/usage/summary payload,
|
||||
// which aggregates usage over the current billing period (monthly).
|
||||
type UpstreamUsageSummaryResponse struct {
|
||||
TotalCount int64 `json:"totalCount"`
|
||||
TotalCost float64 `json:"totalCost"`
|
||||
TotalCredits float64 `json:"totalCredits"`
|
||||
TotalMonthlyCredits float64 `json:"totalMonthlyCredits"`
|
||||
TotalPurchasedCredits float64 `json:"totalPurchasedCredits"`
|
||||
PeriodBasis string `json:"periodBasis"`
|
||||
}
|
||||
|
||||
// UsageWindowLimitsData contains both windows.
|
||||
type UsageWindowLimitsData struct {
|
||||
Monthly UsageWindowLimitData `json:"monthly"`
|
||||
FiveHour UsageWindowLimitData `json:"five_hour"`
|
||||
Weekly UsageWindowLimitData `json:"weekly"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user