From a55835f10c29c1acdc9158bf9e092656ae1a2188 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Wed, 25 Mar 2026 20:05:49 +0200 Subject: [PATCH] fix(api-nodes): made Reve node price badges more precise (#13154) Signed-off-by: bigcat88 --- comfy_api_nodes/nodes_reve.py | 43 +++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/comfy_api_nodes/nodes_reve.py b/comfy_api_nodes/nodes_reve.py index 608d9f058..a87395394 100644 --- a/comfy_api_nodes/nodes_reve.py +++ b/comfy_api_nodes/nodes_reve.py @@ -145,7 +145,20 @@ class ReveImageCreateNode(IO.ComfyNode): ], is_api_node=True, price_badge=IO.PriceBadge( - expr="""{"type":"usd","usd":0.03432,"format":{"approximate":true,"note":"(base)"}}""", + depends_on=IO.PriceBadgeDepends( + widgets=["upscale", "upscale.upscale_factor"], + ), + expr=""" + ( + $factor := $lookup(widgets, "upscale.upscale_factor"); + $fmt := {"approximate": true, "note": "(base)"}; + widgets.upscale = "enabled" ? ( + $factor = 4 ? {"type": "usd", "usd": 0.0762, "format": $fmt} + : $factor = 3 ? {"type": "usd", "usd": 0.0591, "format": $fmt} + : {"type": "usd", "usd": 0.0457, "format": $fmt} + ) : {"type": "usd", "usd": 0.03432, "format": $fmt} + ) + """, ), ) @@ -225,13 +238,21 @@ class ReveImageEditNode(IO.ComfyNode): is_api_node=True, price_badge=IO.PriceBadge( depends_on=IO.PriceBadgeDepends( - widgets=["model"], + widgets=["model", "upscale", "upscale.upscale_factor"], ), expr=""" ( + $fmt := {"approximate": true, "note": "(base)"}; $isFast := $contains(widgets.model, "fast"); - $base := $isFast ? 0.01001 : 0.0572; - {"type": "usd", "usd": $base, "format": {"approximate": true, "note": "(base)"}} + $enabled := widgets.upscale = "enabled"; + $factor := $lookup(widgets, "upscale.upscale_factor"); + $isFast + ? {"type": "usd", "usd": 0.01001, "format": $fmt} + : $enabled ? ( + $factor = 4 ? {"type": "usd", "usd": 0.0991, "format": $fmt} + : $factor = 3 ? {"type": "usd", "usd": 0.0819, "format": $fmt} + : {"type": "usd", "usd": 0.0686, "format": $fmt} + ) : {"type": "usd", "usd": 0.0572, "format": $fmt} ) """, ), @@ -327,13 +348,21 @@ class ReveImageRemixNode(IO.ComfyNode): is_api_node=True, price_badge=IO.PriceBadge( depends_on=IO.PriceBadgeDepends( - widgets=["model"], + widgets=["model", "upscale", "upscale.upscale_factor"], ), expr=""" ( + $fmt := {"approximate": true, "note": "(base)"}; $isFast := $contains(widgets.model, "fast"); - $base := $isFast ? 0.01001 : 0.0572; - {"type": "usd", "usd": $base, "format": {"approximate": true, "note": "(base)"}} + $enabled := widgets.upscale = "enabled"; + $factor := $lookup(widgets, "upscale.upscale_factor"); + $isFast + ? {"type": "usd", "usd": 0.01001, "format": $fmt} + : $enabled ? ( + $factor = 4 ? {"type": "usd", "usd": 0.0991, "format": $fmt} + : $factor = 3 ? {"type": "usd", "usd": 0.0819, "format": $fmt} + : {"type": "usd", "usd": 0.0686, "format": $fmt} + ) : {"type": "usd", "usd": 0.0572, "format": $fmt} ) """, ),