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), }) }