fix(image): only price image model use N ratio

This commit is contained in:
Xyfacai
2026-04-24 01:24:14 +08:00
parent 65b1654732
commit 69ba18d392
+4 -2
View File
@@ -122,8 +122,10 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
// calculation (both price-based and ratio-based paths). // calculation (both price-based and ratio-based paths).
// Adaptors may have already set a more accurate count from the // Adaptors may have already set a more accurate count from the
// upstream response; only set the default when they haven't. // upstream response; only set the default when they haven't.
if _, hasN := info.PriceData.OtherRatios["n"]; !hasN { if info.PriceData.UsePrice { // only price model use N ratio
info.PriceData.AddOtherRatio("n", float64(imageN)) if _, hasN := info.PriceData.OtherRatios["n"]; !hasN {
info.PriceData.AddOtherRatio("n", float64(imageN))
}
} }
if usage.(*dto.Usage).TotalTokens == 0 { if usage.(*dto.Usage).TotalTokens == 0 {