mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-09 02:03:42 +08:00
feat: update image model ratios and adjust quota calculations for billing
This commit is contained in:
@@ -193,12 +193,12 @@ func RelayImageHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
|
||||
switch meta.ChannelType {
|
||||
case channeltype.Replicate:
|
||||
// replicate always return 1 image
|
||||
quota = int64(ratio * imageCostRatio)
|
||||
quota = int64(ratio*imageCostRatio) * 1000
|
||||
default:
|
||||
quota = int64(ratio*imageCostRatio) * int64(imageRequest.N)
|
||||
quota = int64(ratio*imageCostRatio) * int64(imageRequest.N) * 1000
|
||||
}
|
||||
|
||||
if userQuota-quota < 0 {
|
||||
if userQuota < quota {
|
||||
return openai.ErrorWrapper(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user