mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
added price badges for 4 more node-packs
This commit is contained in:
parent
0e944babd6
commit
93e148c548
@ -134,6 +134,9 @@ class MinimaxTextToVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
expr="""{"type":"usd","usd":0.43}""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -197,6 +200,9 @@ class MinimaxImageToVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
expr="""{"type":"usd","usd":0.43}""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -340,6 +346,30 @@ class MinimaxHailuoVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["resolution", "duration"]),
|
||||
expr="""
|
||||
(
|
||||
$r := w.resolution.s;
|
||||
$d := w.duration.s;
|
||||
|
||||
$price :=
|
||||
$contains($r,"768p")
|
||||
? (
|
||||
$contains($d,"6") ? 0.28 :
|
||||
$contains($d,"10") ? 0.56 :
|
||||
0.43
|
||||
)
|
||||
: $contains($r,"1080p")
|
||||
? (
|
||||
$contains($d,"6") ? 0.49 : 0.43
|
||||
)
|
||||
: 0.43;
|
||||
|
||||
{"type":"usd","usd": $price}
|
||||
)
|
||||
""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@ -233,6 +233,15 @@ class MoonvalleyImg2VideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["length"]),
|
||||
expr="""
|
||||
(
|
||||
$len := w.length.s;
|
||||
{"type":"usd","usd": ($len = "10s" ? 3.0 : 1.5)}
|
||||
)
|
||||
""",
|
||||
), # TO-DO: This is 1:1 code from frontend, but this makes no sense as we don't have `length` widget
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -351,6 +360,15 @@ class MoonvalleyVideo2VideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["length"]),
|
||||
expr="""
|
||||
(
|
||||
$len := w.length.s;
|
||||
{"type":"usd","usd": ($len = "10s" ? 4.0 : 2.25)}
|
||||
)
|
||||
""",
|
||||
), # TO-DO: This is 1:1 code from frontend, but this makes no sense as we don't have `length` widget
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -471,6 +489,15 @@ class MoonvalleyTxt2VideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["length"]),
|
||||
expr="""
|
||||
(
|
||||
$len := w.length.s;
|
||||
{"type":"usd","usd": ($len = "10s" ? 3.0 : 1.5)}
|
||||
)
|
||||
""",
|
||||
), # TO-DO: This is 1:1 code from frontend, but this makes no sense as we don't have `length` widget
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@ -160,6 +160,23 @@ class OpenAIDalle2(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["size", "n"]),
|
||||
expr="""
|
||||
(
|
||||
$size := w.size.s;
|
||||
$nRaw := w.n.n;
|
||||
$n := ($nRaw != null and $nRaw != 0) ? $nRaw : 1;
|
||||
|
||||
$base :=
|
||||
$contains($size, "256x256") ? 0.016 :
|
||||
$contains($size, "512x512") ? 0.018 :
|
||||
0.02;
|
||||
|
||||
{"type":"usd","usd": $round($base * $n, 3)}
|
||||
)
|
||||
""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -287,6 +304,25 @@ class OpenAIDalle3(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["size", "quality"]),
|
||||
expr="""
|
||||
(
|
||||
$size := w.size.s;
|
||||
$q := w.quality.s;
|
||||
$hd := $contains($q, "hd");
|
||||
|
||||
$price :=
|
||||
$contains($size, "1024x1024")
|
||||
? ($hd ? 0.08 : 0.04)
|
||||
: (($contains($size, "1792x1024") or $contains($size, "1024x1792"))
|
||||
? ($hd ? 0.12 : 0.08)
|
||||
: 0.04);
|
||||
|
||||
{"type":"usd","usd": $price}
|
||||
)
|
||||
""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -411,6 +447,28 @@ class OpenAIGPTImage1(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["quality", "n"]),
|
||||
expr="""
|
||||
(
|
||||
$ranges := {
|
||||
"low": [0.011, 0.02],
|
||||
"medium": [0.046, 0.07],
|
||||
"high": [0.167, 0.3]
|
||||
};
|
||||
$range := $lookup($ranges, w.quality.s);
|
||||
$n := w.n.n;
|
||||
($n = 1)
|
||||
? {"type":"range_usd","min_usd": $range[0], "max_usd": $range[1]}
|
||||
: {
|
||||
"type":"range_usd",
|
||||
"min_usd": $range[0],
|
||||
"max_usd": $range[1],
|
||||
"format": { "suffix": " x " & $string($n) & "/Run" }
|
||||
}
|
||||
)
|
||||
""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -566,6 +624,28 @@ class OpenAIChatNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["model"]),
|
||||
expr="""
|
||||
(
|
||||
$m := w.model.s;
|
||||
|
||||
$contains($m,"o4-mini") ? {"type":"list_usd","usd":[0.0011,0.0044]} :
|
||||
$contains($m,"o1-pro") ? {"type":"list_usd","usd":[0.15,0.6]} :
|
||||
$contains($m,"o1") ? {"type":"list_usd","usd":[0.015,0.06]} :
|
||||
$contains($m,"o3-mini") ? {"type":"list_usd","usd":[0.0011,0.0044]} :
|
||||
$contains($m,"o3") ? {"type":"list_usd","usd":[0.01,0.04]} :
|
||||
$contains($m,"gpt-4o") ? {"type":"list_usd","usd":[0.0025,0.01]} :
|
||||
$contains($m,"gpt-4.1-nano") ? {"type":"list_usd","usd":[0.0001,0.0004]} :
|
||||
$contains($m,"gpt-4.1-mini") ? {"type":"list_usd","usd":[0.0004,0.0016]} :
|
||||
$contains($m,"gpt-4.1") ? {"type":"list_usd","usd":[0.002,0.008]} :
|
||||
$contains($m,"gpt-5-nano") ? {"type":"list_usd","usd":[0.00005,0.0004]} :
|
||||
$contains($m,"gpt-5-mini") ? {"type":"list_usd","usd":[0.00025,0.002]} :
|
||||
$contains($m,"gpt-5") ? {"type":"list_usd","usd":[0.00125,0.01]} :
|
||||
{"type":"text","text":"Token-based"}
|
||||
)
|
||||
""",
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@ -128,6 +128,7 @@ class PixverseTextToVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=PRICE_BADGE_VIDEO,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -242,6 +243,7 @@ class PixverseImageToVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=PRICE_BADGE_VIDEO,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -355,6 +357,7 @@ class PixverseTransitionVideoNode(IO.ComfyNode):
|
||||
IO.Hidden.unique_id,
|
||||
],
|
||||
is_api_node=True,
|
||||
price_badge=PRICE_BADGE_VIDEO,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -416,6 +419,46 @@ class PixverseTransitionVideoNode(IO.ComfyNode):
|
||||
return IO.NodeOutput(await download_url_to_video_output(response_poll.Resp.url))
|
||||
|
||||
|
||||
PRICE_BADGE_VIDEO = IO.PriceBadge(
|
||||
depends_on=IO.PriceBadgeDepends(widgets=["duration_seconds", "quality", "motion_mode"]),
|
||||
expr="""
|
||||
(
|
||||
$d := w.duration_seconds.s;
|
||||
$q := w.quality.s;
|
||||
$m := w.motion_mode.s;
|
||||
|
||||
$price :=
|
||||
$contains($d,"5")
|
||||
? (
|
||||
$contains($q,"1080p") ? 1.2 :
|
||||
($contains($q,"720p") and $contains($m,"fast")) ? 1.2 :
|
||||
($contains($q,"720p") and $contains($m,"normal")) ? 0.6 :
|
||||
($contains($q,"540p") and $contains($m,"fast")) ? 0.9 :
|
||||
($contains($q,"540p") and $contains($m,"normal")) ? 0.45 :
|
||||
($contains($q,"360p") and $contains($m,"fast")) ? 0.9 :
|
||||
($contains($q,"360p") and $contains($m,"normal")) ? 0.45 :
|
||||
0.9
|
||||
)
|
||||
: $contains($d,"8")
|
||||
? (
|
||||
($contains($q,"540p") and $contains($m,"normal")) ? 0.9 :
|
||||
($contains($q,"540p") and $contains($m,"fast")) ? 1.2 :
|
||||
($contains($q,"360p") and $contains($m,"normal")) ? 0.9 :
|
||||
($contains($q,"360p") and $contains($m,"fast")) ? 1.2 :
|
||||
($contains($q,"1080p") and $contains($m,"normal")) ? 1.2 :
|
||||
($contains($q,"1080p") and $contains($m,"fast")) ? 1.2 :
|
||||
($contains($q,"720p") and $contains($m,"normal")) ? 1.2 :
|
||||
($contains($q,"720p") and $contains($m,"fast")) ? 1.2 :
|
||||
0.9
|
||||
)
|
||||
: 0.9;
|
||||
|
||||
{"type":"usd","usd": $price}
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
class PixVerseExtension(ComfyExtension):
|
||||
@override
|
||||
async def get_node_list(self) -> list[type[IO.ComfyNode]]:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user