diff --git a/plugin/management.go b/plugin/management.go index 2c7af20..7ae4aa2 100644 --- a/plugin/management.go +++ b/plugin/management.go @@ -182,7 +182,16 @@ func executeUsageQuery(ctx context.Context, apiBase, sessionToken, hostCallbackI }, nil } - usage, errParse := ParseAndFormatUsage(raw, time.Now().UTC()) + // Fetch billing-period (monthly) usage totals; non-fatal if unavailable. + var summary *UpstreamUsageSummaryResponse + if sumRaw, sumStatus, sumErr := FetchUsageSummaryRaw(ctx, apiBase, sessionToken, hostCallbackID); sumErr == nil && sumStatus == http.StatusOK { + var parsed UpstreamUsageSummaryResponse + if errSum := json.Unmarshal(sumRaw, &parsed); errSum == nil && parsed.TotalMonthlyCredits > 0 { + summary = &parsed + } + } + + usage, errParse := ParseAndFormatUsage(raw, summary, time.Now().UTC()) if errParse != nil { resBytes, _ := json.Marshal(map[string]any{ "ok": false, diff --git a/plugin/quota_page.go b/plugin/quota_page.go index be5b2af..e64966e 100644 --- a/plugin/quota_page.go +++ b/plugin/quota_page.go @@ -676,6 +676,37 @@ const QuotaPageHTML = `