fix(billing): reject saturated pre-consume quota

This commit is contained in:
CaIon
2026-07-11 13:14:21 +08:00
parent dad57a6bb8
commit 621927f710
5 changed files with 124 additions and 5 deletions
+7
View File
@@ -12,3 +12,10 @@ import "github.com/QuantumNous/new-api/common"
func QuotaRound(f float64) int {
return common.QuotaRound(f)
}
// QuotaRoundChecked is QuotaRound but also reports whether the result had to
// be saturated. Pre-consume callers use this to reject an unrepresentable
// estimate before any quota is deducted.
func QuotaRoundChecked(f float64) (int, *common.QuotaClamp) {
return common.QuotaRoundChecked(f)
}