diff --git a/auth/payment.go b/auth/payment.go index 44f6fe5d..96cfba96 100644 --- a/auth/payment.go +++ b/auth/payment.go @@ -80,6 +80,8 @@ func CanEnableModel(db *sql.DB, user *User, model string) bool { return user != nil && user.GetQuota(db) >= 50 case globals.SparkDesk: return user != nil && user.GetQuota(db) >= 1 + case globals.Claude2100k: + return user != nil && user.GetQuota(db) >= 1 default: return true } diff --git a/utils/tokenizer.go b/utils/tokenizer.go index d808c174..cdda6a66 100644 --- a/utils/tokenizer.go +++ b/utils/tokenizer.go @@ -106,8 +106,10 @@ func CountInputToken(model string, v []globals.Message) float32 { return float32(CountTokenPrice(v, model)) / 1000 * 4.2 case globals.SparkDesk: return float32(CountTokenPrice(v, model)) / 1000 * 0.36 - case globals.Claude2, globals.Claude2100k: + case globals.Claude2: return 0 + case globals.Claude2100k: + return float32(CountTokenPrice(v, model)) / 1000 * 0.008 default: return 0 } @@ -125,8 +127,10 @@ func CountOutputToken(model string, t int) float32 { return float32(t*GetWeightByModel(model)) / 1000 * 8.6 case globals.SparkDesk: return float32(t*GetWeightByModel(model)) / 1000 * 0.36 - case globals.Claude2, globals.Claude2100k: + case globals.Claude2: return 0 + case globals.Claude2100k: + return float32(t*GetWeightByModel(model)) / 1000 * 0.008 default: return 0 }