From 69ba18d3922d4ecae2ce01130ea49320065e8c40 Mon Sep 17 00:00:00 2001 From: Xyfacai Date: Fri, 24 Apr 2026 01:24:14 +0800 Subject: [PATCH] fix(image): only price image model use N ratio --- relay/image_handler.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/relay/image_handler.go b/relay/image_handler.go index a4fee7d9..e986dd89 100644 --- a/relay/image_handler.go +++ b/relay/image_handler.go @@ -122,8 +122,10 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type // calculation (both price-based and ratio-based paths). // Adaptors may have already set a more accurate count from the // upstream response; only set the default when they haven't. - if _, hasN := info.PriceData.OtherRatios["n"]; !hasN { - info.PriceData.AddOtherRatio("n", float64(imageN)) + if info.PriceData.UsePrice { // only price model use N ratio + if _, hasN := info.PriceData.OtherRatios["n"]; !hasN { + info.PriceData.AddOtherRatio("n", float64(imageN)) + } } if usage.(*dto.Usage).TotalTokens == 0 {