The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
[Partner Nodes] feat(Google): add Nano Banana 2.1 to the Nano Banana 2 node (#16822)
Alexander Piskun0b5b009dd449
diff --git a/comfy_api_nodes/nodes_gemini.py b/comfy_api_nodes/nodes_gemini.pyindex 0977035ca..1862fb35c 100644--- a/comfy_api_nodes/nodes_gemini.py+++ b/comfy_api_nodes/nodes_gemini.py@@ -1556,7 +1556,7 @@ class GeminiNanoBanana2(IO.ComfyNode):)-def _nano_banana_2_v2_model_inputs(resolutions: list[str]):+def _nano_banana_2_v2_model_inputs(resolutions: list[str], thinking_levels: list[str], thinking_default: str):return [IO.Combo.Input("aspect_ratio",@@ -1588,7 +1588,8 @@ def _nano_banana_2_v2_model_inputs(resolutions: list[str]):),IO.Combo.Input("thinking_level",- options=["MINIMAL", "HIGH"],+ options=thinking_levels,+ default=thinking_default,),IO.Autogrow.Input("images",@@ -1614,7 +1615,7 @@ class GeminiNanoBanana2V2(IO.ComfyNode):def define_schema(cls):return IO.Schema(node_id="GeminiNanoBanana2V2",- display_name="Nano Banana 2",+ display_name="Nano Banana 2.1",category="partner/image/Gemini",description="Generate or edit images synchronously via Google Vertex API.",inputs=[@@ -1628,13 +1629,29 @@ class GeminiNanoBanana2V2(IO.ComfyNode):IO.DynamicCombo.Input("model",options=[+ IO.DynamicCombo.Option(+ "Gemini Nano Banana 2.1",+ _nano_banana_2_v2_model_inputs(+ resolutions=["1K", "2K", "4K"],+ thinking_levels=["MINIMAL", "MEDIUM", "HIGH"],+ thinking_default="MEDIUM",+ ),+ ),IO.DynamicCombo.Option("Nano Banana 2 (Gemini 3.1 Flash Image)",- _nano_banana_2_v2_model_inputs(resolutions=["1K", "2K", "4K"]),+ _nano_banana_2_v2_model_inputs(+ resolutions=["1K", "2K", "4K"],+ thinking_levels=["MINIMAL", "HIGH"],+ thinking_default="MINIMAL",+ ),),IO.DynamicCombo.Option("Nano Banana 2 Lite",- _nano_banana_2_v2_model_inputs(resolutions=["1K"]),+ _nano_banana_2_v2_model_inputs(+ resolutions=["1K"],+ thinking_levels=["MINIMAL", "HIGH"],+ thinking_default="MINIMAL",+ ),),],),@@ -1690,7 +1707,7 @@ class GeminiNanoBanana2V2(IO.ComfyNode):IO.Image.Output(display_name="thought_image",tooltip="First image from the model's thinking process. "- "Only available with thinking_level HIGH and IMAGE+TEXT modality.",+ "Only available with IMAGE+TEXT modality.",),],hidden=[@@ -1700,16 +1717,28 @@ class GeminiNanoBanana2V2(IO.ComfyNode):],is_api_node=True,price_badge=IO.PriceBadge(- depends_on=IO.PriceBadgeDepends(widgets=["model", "model.resolution"]),+ depends_on=IO.PriceBadgeDepends(widgets=["model", "model.resolution", "model.thinking_level"]),expr="""($contains(widgets.model, "lite")? {"type":"usd","usd": 0.0408, "format":{"suffix":"/Image","approximate":true}}- : (- $r := $lookup(widgets, "model.resolution");- $prices := {"1k": 0.0835, "2k": 0.1217, "4k": 0.1848};- {"type":"usd","usd": $lookup($prices, $r), "format":{"suffix":"/Image","approximate":true}}- )+ : $contains(widgets.model, "banana 2.1")+ ? (+ $r := $lookup(widgets, "model.resolution");+ $t := $lookup(widgets, "model.thinking_level");+ $image := {"1k": 0.048048, "2k": 0.072072, "4k": 0.162162};+ $thinking := {"minimal": 0, "medium": 0.010725, "high": 0.01769625};+ {+ "type":"usd",+ "usd": $lookup($image, $r) + $lookup($thinking, $t),+ "format":{"suffix":"/Image","approximate":true}+ }+ )+ : (+ $r := $lookup(widgets, "model.resolution");+ $prices := {"1k": 0.0835, "2k": 0.1217, "4k": 0.1848};+ {"type":"usd","usd": $lookup($prices, $r), "format":{"suffix":"/Image","approximate":true}}+ ))""",),@@ -1728,7 +1757,10 @@ class GeminiNanoBanana2V2(IO.ComfyNode):) -> IO.NodeOutput:validate_string(prompt, strip_whitespace=True, min_length=1)model_choice = model["model"]- if model_choice == "Nano Banana 2 (Gemini 3.1 Flash Image)":+ if model_choice == "Gemini Nano Banana 2.1":+ model_id = "gemini-nano-banana-2.1"+ temperature = top_p = None+ elif model_choice == "Nano Banana 2 (Gemini 3.1 Flash Image)":model_id = "gemini-3.1-flash-image"elif model_choice == "Nano Banana 2 Lite":model_id = "gemini-3.1-flash-lite-image"