[Partner Nodes] feat(Google): add Nano Banana 2 Lite model (#14693)
Some checks are pending
Detect Unreviewed Merge / detect (push) Waiting to run
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Waiting to run
Execution Tests / test (macos-latest) (push) Waiting to run
Execution Tests / test (ubuntu-latest) (push) Waiting to run
Execution Tests / test (windows-latest) (push) Waiting to run
Test server launches without errors / test (push) Waiting to run
Unit Tests / test (macos-latest) (push) Waiting to run
Unit Tests / test (ubuntu-latest) (push) Waiting to run
Unit Tests / test (windows-2022) (push) Waiting to run

Signed-off-by: bigcat88 <bigcat88@icloud.com>
This commit is contained in:
Alexander Piskun 2026-06-30 21:17:23 +03:00 committed by GitHub
parent ba3f697dbb
commit 8fe0243d97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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