mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-21 05:48:16 +08:00
Merge branch 'master' into matt/be-788-enable-asset-hashing
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
This commit is contained in:
commit
173984f5e5
@ -249,18 +249,22 @@ def calculate_tokens_price(response: GeminiGenerateContentResponse) -> float | N
|
|||||||
input_tokens_price = 2
|
input_tokens_price = 2
|
||||||
output_text_tokens_price = 12.0
|
output_text_tokens_price = 12.0
|
||||||
output_image_tokens_price = 0.0
|
output_image_tokens_price = 0.0
|
||||||
elif response.modelVersion == "gemini-3.1-flash-lite-preview":
|
elif response.modelVersion in ("gemini-3.1-flash-lite-preview", "gemini-3.1-flash-lite"):
|
||||||
input_tokens_price = 0.25
|
input_tokens_price = 0.25
|
||||||
output_text_tokens_price = 1.50
|
output_text_tokens_price = 1.50
|
||||||
output_image_tokens_price = 0.0
|
output_image_tokens_price = 0.0
|
||||||
elif response.modelVersion == "gemini-3-pro-image-preview":
|
elif response.modelVersion in ("gemini-3-pro-image-preview", "gemini-3-pro-image"):
|
||||||
input_tokens_price = 2
|
input_tokens_price = 2
|
||||||
output_text_tokens_price = 12.0
|
output_text_tokens_price = 12.0
|
||||||
output_image_tokens_price = 120.0
|
output_image_tokens_price = 120.0
|
||||||
elif response.modelVersion == "gemini-3.1-flash-image-preview":
|
elif response.modelVersion in ("gemini-3.1-flash-image-preview", "gemini-3.1-flash-image"):
|
||||||
input_tokens_price = 0.5
|
input_tokens_price = 0.5
|
||||||
output_text_tokens_price = 3.0
|
output_text_tokens_price = 3.0
|
||||||
output_image_tokens_price = 60.0
|
output_image_tokens_price = 60.0
|
||||||
|
elif response.modelVersion == "gemini-3.1-flash-lite-image":
|
||||||
|
input_tokens_price = 0.25
|
||||||
|
output_text_tokens_price = 1.50
|
||||||
|
output_image_tokens_price = 30.0
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
final_price = response.usageMetadata.promptTokenCount * input_tokens_price
|
final_price = response.usageMetadata.promptTokenCount * input_tokens_price
|
||||||
@ -1302,7 +1306,7 @@ class GeminiNanoBanana2(IO.ComfyNode):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _nano_banana_2_v2_model_inputs():
|
def _nano_banana_2_v2_model_inputs(resolutions: list[str]):
|
||||||
return [
|
return [
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"aspect_ratio",
|
"aspect_ratio",
|
||||||
@ -1329,8 +1333,8 @@ def _nano_banana_2_v2_model_inputs():
|
|||||||
),
|
),
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"resolution",
|
"resolution",
|
||||||
options=["1K", "2K", "4K"],
|
options=resolutions,
|
||||||
tooltip="Target output resolution. For 2K/4K the native Gemini upscaler is used.",
|
tooltip="Target output resolution.",
|
||||||
),
|
),
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"thinking_level",
|
"thinking_level",
|
||||||
@ -1376,7 +1380,11 @@ class GeminiNanoBanana2V2(IO.ComfyNode):
|
|||||||
options=[
|
options=[
|
||||||
IO.DynamicCombo.Option(
|
IO.DynamicCombo.Option(
|
||||||
"Nano Banana 2 (Gemini 3.1 Flash Image)",
|
"Nano Banana 2 (Gemini 3.1 Flash Image)",
|
||||||
_nano_banana_2_v2_model_inputs(),
|
_nano_banana_2_v2_model_inputs(resolutions=["1K", "2K", "4K"]),
|
||||||
|
),
|
||||||
|
IO.DynamicCombo.Option(
|
||||||
|
"Nano Banana 2 Lite",
|
||||||
|
_nano_banana_2_v2_model_inputs(resolutions=["1K"]),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -1445,9 +1453,13 @@ class GeminiNanoBanana2V2(IO.ComfyNode):
|
|||||||
depends_on=IO.PriceBadgeDepends(widgets=["model", "model.resolution"]),
|
depends_on=IO.PriceBadgeDepends(widgets=["model", "model.resolution"]),
|
||||||
expr="""
|
expr="""
|
||||||
(
|
(
|
||||||
$r := $lookup(widgets, "model.resolution");
|
$contains(widgets.model, "lite")
|
||||||
$prices := {"1k": 0.0696, "2k": 0.1014, "4k": 0.154};
|
? {"type":"usd","usd": 0.034, "format":{"suffix":"/Image","approximate":true}}
|
||||||
{"type":"usd","usd": $lookup($prices, $r), "format":{"suffix":"/Image","approximate":true}}
|
: (
|
||||||
|
$r := $lookup(widgets, "model.resolution");
|
||||||
|
$prices := {"1k": 0.0696, "2k": 0.1014, "4k": 0.154};
|
||||||
|
{"type":"usd","usd": $lookup($prices, $r), "format":{"suffix":"/Image","approximate":true}}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
),
|
),
|
||||||
@ -1468,6 +1480,8 @@ class GeminiNanoBanana2V2(IO.ComfyNode):
|
|||||||
model_choice = model["model"]
|
model_choice = model["model"]
|
||||||
if model_choice == "Nano Banana 2 (Gemini 3.1 Flash Image)":
|
if model_choice == "Nano Banana 2 (Gemini 3.1 Flash Image)":
|
||||||
model_id = "gemini-3.1-flash-image-preview"
|
model_id = "gemini-3.1-flash-image-preview"
|
||||||
|
elif model_choice == "Nano Banana 2 Lite":
|
||||||
|
model_id = "gemini-3.1-flash-lite-image"
|
||||||
else:
|
else:
|
||||||
model_id = model_choice
|
model_id = model_choice
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ alembic
|
|||||||
SQLAlchemy>=2.0.0
|
SQLAlchemy>=2.0.0
|
||||||
filelock
|
filelock
|
||||||
av>=16.0.0
|
av>=16.0.0
|
||||||
comfy-kitchen==0.2.15
|
comfy-kitchen==0.2.16
|
||||||
comfy-aimdo==0.4.10
|
comfy-aimdo==0.4.10
|
||||||
requests
|
requests
|
||||||
simpleeval>=1.0.0
|
simpleeval>=1.0.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user