This commit is contained in:
greeneclipse committed 2026-10-20 17:50:32 +02:00
1 parent fd83a7c523
commit edbbf127ba
12 files changed
+246 -207

No files matched your search

@@ -120,21 +120,13 @@ func (s *Server) handleCompanyContentCosts(w http.ResponseWriter, r *http.Reques
Error(w, http.StatusUnauthorized, "unauthorized")
return
}
rates, err := s.Billing.ContentRates(r.Context(), cid)
if err != nil {
LogAndError(w, http.StatusInternalServerError, "could not load credit costs", err)
return
}
out := make(map[string]float64, len(rates))
for key, units := range rates {
out[key] = float64(units) / 10000
}
mode := "outputs"
if _, ok := rates["product"]; ok {
mode = "product"
}
// Flat charge for one product in one selected language. Never derive a
// displayed estimate from per-output admin rates or the EUR/credit value.
w.Header().Set("Cache-Control", "private, no-store")
JSON(w, http.StatusOK, map[string]any{"mode": mode, "credits": out})
JSON(w, http.StatusOK, map[string]any{
"mode": "product",
"credits": map[string]float64{"product": 1},
})
}
// Monetary credit valuation is an admin reference rate. Stripe invoices, pack