Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions comfy_api_nodes/apis/bytedance.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ class SeedanceVirtualLibraryCreateAssetRequest(BaseModel):
("dreamina-seedance-2-0-fast-260128", True, "480p"): 0.0033,
("dreamina-seedance-2-0-fast-260128", False, "720p"): 0.0056,
("dreamina-seedance-2-0-fast-260128", True, "720p"): 0.0033,
("dreamina-seedance-2-0-mini", False, "480p"): 0.0035,
("dreamina-seedance-2-0-mini", True, "480p"): 0.0019,
("dreamina-seedance-2-0-mini", False, "720p"): 0.0035,
("dreamina-seedance-2-0-mini", True, "720p"): 0.0019,
}


Expand Down Expand Up @@ -278,6 +282,10 @@ def seedance2_price_per_1k_tokens(model_id: str, has_video_input: bool, resoluti
"480p": {"min": 409_600, "max": 927_408},
"720p": {"min": 409_600, "max": 927_408},
},
"dreamina-seedance-2-0-mini": {
"480p": {"min": 409_600, "max": 927_408},
"720p": {"min": 409_600, "max": 927_408},
},
}

# The time in this dictionary are given for 10 seconds duration.
Expand Down
33 changes: 25 additions & 8 deletions comfy_api_nodes/nodes_bytedance.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
SEEDANCE_MODELS = {
"Seedance 2.0": "dreamina-seedance-2-0-260128",
"Seedance 2.0 Fast": "dreamina-seedance-2-0-fast-260128",
"Seedance 2.0 Mini": "dreamina-seedance-2-0-mini",
}

DEPRECATED_MODELS = {"seedance-1-0-lite-t2v-250428", "seedance-1-0-lite-i2v-250428"}
Expand Down Expand Up @@ -1623,8 +1624,10 @@ def define_schema(cls):
options=[
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_text_inputs(["480p", "720p", "1080p", "4k"])),
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_text_inputs(["480p", "720p"])),
IO.DynamicCombo.Option("Seedance 2.0 Mini", _seedance2_text_inputs(["480p", "720p"])),
],
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization; "
"Seedance 2.0 Mini for the lowest cost.",
),
IO.Int.Input(
"seed",
Expand Down Expand Up @@ -1664,7 +1667,8 @@ def define_schema(cls):
$m := widgets.model;
$res := $lookup(widgets, "model.resolution");
$dur := $lookup(widgets, "model.duration");
$pricePer1K := $res = "4k" ? 0.00572 :
$pricePer1K := $contains($m, "Mini") ? 0.005005 :
$res = "4k" ? 0.00572 :
$res = "1080p" ? 0.011011 :
$contains($m, "fast") ? 0.008008 : 0.01001;
$rate := $res = "4k" ? $rate4k :
Expand Down Expand Up @@ -1734,8 +1738,13 @@ def define_schema(cls):
"Seedance 2.0 Fast",
_seedance2_text_inputs(["480p", "720p"], default_ratio="adaptive"),
),
IO.DynamicCombo.Option(
"Seedance 2.0 Mini",
_seedance2_text_inputs(["480p", "720p"], default_ratio="adaptive"),
),
],
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization; "
"Seedance 2.0 Mini for the lowest cost.",
),
IO.Image.Input(
"first_frame",
Expand Down Expand Up @@ -1799,7 +1808,8 @@ def define_schema(cls):
$m := widgets.model;
$res := $lookup(widgets, "model.resolution");
$dur := $lookup(widgets, "model.duration");
$pricePer1K := $res = "4k" ? 0.00572 :
$pricePer1K := $contains($m, "Mini") ? 0.005005 :
$res = "4k" ? 0.00572 :
$res = "1080p" ? 0.011011 :
$contains($m, "fast") ? 0.008008 : 0.01001;
$rate := $res = "4k" ? $rate4k :
Expand Down Expand Up @@ -2024,8 +2034,13 @@ def define_schema(cls):
"Seedance 2.0 Fast",
_seedance2_reference_inputs(["480p", "720p"], default_ratio="adaptive"),
),
IO.DynamicCombo.Option(
"Seedance 2.0 Mini",
_seedance2_reference_inputs(["480p", "720p"], default_ratio="adaptive"),
),
],
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization; "
"Seedance 2.0 Mini for the lowest cost.",
),
IO.Int.Input(
"seed",
Expand Down Expand Up @@ -2069,18 +2084,20 @@ def define_schema(cls):
$hasVideo := $lookup(inputGroups, "model.reference_videos") > 0;
$res := $lookup(widgets, "model.resolution");
$dur := $lookup(widgets, "model.duration");
$noVideoPricePer1K := $res = "4k" ? 0.00572 :
$noVideoPricePer1K := $contains($m, "Mini") ? 0.005005 :
$res = "4k" ? 0.00572 :
$res = "1080p" ? 0.011011 :
$contains($m, "fast") ? 0.008008 : 0.01001;
$videoPricePer1K := $res = "4k" ? 0.003432 :
$videoPricePer1K := $contains($m, "Mini") ? 0.002717 :
$res = "4k" ? 0.003432 :
$res = "1080p" ? 0.006721 :
$contains($m, "fast") ? 0.004719 : 0.006149;
$rate := $res = "4k" ? $rate4k :
$res = "1080p" ? $rate1080 :
$res = "720p" ? $rate720 :
$rate480;
$noVideoCost := $dur * $rate * $noVideoPricePer1K / 1000;
$minVideoFactor := $ceil($dur * 5 / 3);
$minVideoFactor := $contains($m, "Mini") ? (3 + $dur) : $ceil($dur * 5 / 3);
$minVideoCost := $minVideoFactor * $rate * $videoPricePer1K / 1000;
$maxVideoCost := (15 + $dur) * $rate * $videoPricePer1K / 1000;
$hasVideo
Expand Down
Loading