This commit is contained in:
greeneclipse committed 2026-10-16 13:48:51 +02:00
1 parent feebf7d3c1
commit 486502852e
41 files changed
+1311 -259

No files matched your search

@@ -27,19 +27,19 @@ func (s *Server) handleBillingUsageExport(w http.ResponseWriter, r *http.Request
_ = out.Write([]string{"company_id", "range", "metric", "value", "notes"})
rows := []struct {
label string
value int64
value float64
notes string
}{
{"ai_calls", usage.AICalls, "Recorded provider calls in period"},
{"input_tokens", usage.InputTokens, "Includes cached input"},
{"cached_input_tokens", usage.CachedInputTokens, "Subset of input"},
{"output_tokens", usage.OutputTokens, ""},
{"products_processed", int64(usage.ProductsProcessed), "Period"},
{"credits_used_wallet", int64(usage.CreditsUsed), "All-time wallet balance, not period credits"},
{"credits_remaining", int64(usage.CreditsRemaining), "Current wallet"},
{"ai_calls", float64(usage.AICalls), "Recorded provider calls in period"},
{"input_tokens", float64(usage.InputTokens), "Includes cached input"},
{"cached_input_tokens", float64(usage.CachedInputTokens), "Subset of input"},
{"output_tokens", float64(usage.OutputTokens), ""},
{"products_processed", float64(usage.ProductsProcessed), "Period"},
{"credits_used_wallet", usage.CreditsUsed, "All-time wallet balance, not period credits"},
{"credits_remaining", usage.CreditsRemaining, "Current wallet"},
}
for _, v := range rows {
_ = out.Write([]string{cid.String(), usage.Range, v.label, strconv.FormatInt(v.value, 10), v.notes})
_ = out.Write([]string{cid.String(), usage.Range, v.label, strconv.FormatFloat(v.value, 'f', -1, 64), v.notes})
}
out.Flush()
}