From f67f4b8caf2e1e4dff520a2bec545d8465d97e37 Mon Sep 17 00:00:00 2001 From: hjjjj <1311711287@qq.com> Date: Fri, 20 Mar 2026 17:50:11 +0800 Subject: [PATCH] fix: no skipping from free model price. --- controller/model.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/controller/model.go b/controller/model.go index 89a161f..6a0c274 100644 --- a/controller/model.go +++ b/controller/model.go @@ -684,14 +684,15 @@ func SyncZenmuxRatios(c *gin.Context) { completionRatioMap = make(map[string]float64) } - updated, skipped := 0, 0 + updated := 0 for _, item := range catalog { - if item.InputPrice <= 0 { - skipped++ - continue + // Only overwrite existing non-zero ratio if new price is also non-zero. + // This preserves manually configured ratios for models where Zenmux reports price=0 + // (e.g. per-image billing models whose token price is not tracked here). + if item.InputPrice > 0 || modelRatioMap[item.Id] == 0 { + modelRatioMap[item.Id] = item.InputPrice } - modelRatioMap[item.Id] = item.InputPrice - if item.OutputPrice > 0 { + if item.InputPrice > 0 && item.OutputPrice > 0 { completionRatioMap[item.Id] = item.OutputPrice / item.InputPrice } updated++ @@ -727,7 +728,7 @@ func SyncZenmuxRatios(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "success": true, - "message": fmt.Sprintf("synced ratios for %d models (%d skipped — no pricing)", updated, skipped), + "message": fmt.Sprintf("synced ratios for %d models", updated), }) }