Skip to content

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(Anthropic): add Sonnet 5.5 model (#16647)

Alexander Piskun8cfe5e1ecb97
diff --git a/comfy_api_nodes/apis/anthropic.py b/comfy_api_nodes/apis/anthropic.py
index 5e74d2355..0ef98f18f 100644
--- a/comfy_api_nodes/apis/anthropic.py
+++ b/comfy_api_nodes/apis/anthropic.py
@@ -36,7 +36,7 @@ class AnthropicMessage(BaseModel):
class AnthropicThinkingConfig(BaseModel):
- type: Literal["enabled", "disabled", "adaptive"] = Field(...)
+ type: Literal["enabled", "disabled", "adaptive", "between_tools"] = Field(...)
budget_tokens: int | None = Field(
None, ge=1024,
description="Reasoning budget in tokens. Used when type is 'enabled'. Must be less than max_tokens.",
diff --git a/comfy_api_nodes/nodes_anthropic.py b/comfy_api_nodes/nodes_anthropic.py
index e627920c5..6be23ec77 100644
--- a/comfy_api_nodes/nodes_anthropic.py
+++ b/comfy_api_nodes/nodes_anthropic.py
@@ -33,6 +33,7 @@ CLAUDE_MODELS: dict[str, str] = {
"Opus 4.8": "claude-opus-4-8",
"Fable 5.1": "claude-fable-5-1",
"Fable 5": "claude-fable-5",
+ "Sonnet 5.5": "claude-sonnet-5-5",
"Sonnet 5": "claude-sonnet-5",
"Opus 4.7": "claude-opus-4-7",
"Opus 4.6": "claude-opus-4-6",
@@ -44,12 +45,13 @@ CLAUDE_MODELS: dict[str, str] = {
_THINKING_UNSUPPORTED = {"Haiku 4.5"}
# Models that use the newer "adaptive" thinking mode (Opus 4.7+ require it; older models keep the explicit budget API).
# Anthropic decides the actual budget when adaptive is used, based on the `output_config.effort` hint.
-_ADAPTIVE_THINKING_MODELS = {"Opus 4.8", "Sonnet 5", "Opus 4.7", "Opus 4.6", "Sonnet 4.6"}
+_ADAPTIVE_THINKING_MODELS = {"Opus 4.8", "Sonnet 5.5", "Sonnet 5", "Opus 4.7", "Opus 4.6", "Sonnet 4.6"}
_ALWAYS_THINKING_MODELS = {"Opus 5.5", "Opus 5", "Fable 5.1", "Fable 5"}
-_XHIGH_EFFORT_MODELS = {"Opus 5.5", "Opus 5", "Opus 4.8", "Fable 5.1", "Fable 5", "Sonnet 5", "Opus 4.7"}
+_XHIGH_EFFORT_MODELS = {"Opus 5.5", "Opus 5", "Opus 4.8", "Fable 5.1", "Fable 5", "Sonnet 5.5", "Sonnet 5", "Opus 4.7"}
_MAX_EFFORT_MODELS = _XHIGH_EFFORT_MODELS | {"Opus 4.6", "Sonnet 4.6"}
-_EXPLICIT_THINKING_OFF_MODELS = {"Sonnet 5"}
-_NO_TEMPERATURE_MODELS = {"Opus 5.5", "Opus 5", "Opus 4.8", "Fable 5.1", "Fable 5", "Sonnet 5"}
+_EXPLICIT_THINKING_OFF_MODELS = {"Sonnet 5.5": "between_tools", "Sonnet 5": "disabled"}
+_NO_TEMPERATURE_MODELS = {"Opus 5.5", "Opus 5", "Opus 4.8", "Fable 5.1", "Fable 5", "Sonnet 5.5", "Sonnet 5"}
+_LOW_MAX_TOKENS_MODELS = {"Opus 5.5", "Sonnet 5.5"}
# Budget mode (Sonnet 4.5): effort -> reasoning budget in tokens. Must be < max_tokens.
# Sized so even the "high" budget fits comfortably under the default max_tokens=32768.
@@ -77,7 +79,7 @@ def _claude_model_inputs(model_label: str):
IO.Int.Input(
"max_tokens",
default=32768,
- min=4096,
+ min=1024 if model_label in _LOW_MAX_TOKENS_MODELS else 4096,
max=64000,
tooltip="Maximum number of tokens to generate (includes reasoning tokens when enabled).",
advanced=True,
@@ -297,7 +299,7 @@ class ClaudeNode(IO.ComfyNode):
budget = min(budget, max(1024, max_tokens - 1024))
thinking_cfg = AnthropicThinkingConfig(type="enabled", budget_tokens=budget)
elif model_label in _EXPLICIT_THINKING_OFF_MODELS:
- thinking_cfg = AnthropicThinkingConfig(type="disabled")
+ thinking_cfg = AnthropicThinkingConfig(type=_EXPLICIT_THINKING_OFF_MODELS[model_label])
image_tensors: list[Input.Image] = [t for t in (images or {}).values() if t is not None]
if sum(get_number_of_images(t) for t in image_tensors) > CLAUDE_MAX_IMAGES: