Skip to content

Anthropic Claude Opus 4.7 node sends deprecated temperature parameter and fails with 400 #13923

Description

@qwqgong-ui

Expected Behavior

The built-in Anthropic Claude API node should run successfully when selecting Opus 4.7.

Actual Behavior

When executing a workflow that uses the built-in Anthropic Claude node with Opus 4.7, the request fails with a 400 invalid request error from Anthropic:

API Error: `temperature` is deprecated for this model. (Type: invalid_request_error)

Relevant Log

2026-05-15 17:04:12.934193 FETCH ComfyRegistry Data [DONE]
[ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes
[ComfyUI-Manager] All startup tasks have been completed.
got prompt
!!! Exception during processing !!! API Error: `temperature` is deprecated for this model. (Type: invalid_request_error)
Traceback (most recent call last):
  File "C:\Users\V\Documents\ComfyUI\ComfyUI\execution.py", line 454, in execute
    raise ex
  File "C:\Users\V\Documents\ComfyUI\ComfyUI\execution.py", line 450, in execute
    results.append(r.result())
  File "C:\Users\V\Documents\ComfyUI\ComfyUI\comfy_api_nodes\nodes_anthropic.py", line 222, in execute
    response = await sync_op(
  File "C:\Users\V\Documents\ComfyUI\ComfyUI\comfy_api_nodes\util\client.py", line 789, in _request_base
    raise Exception(msg)
Exception: API Error: `temperature` is deprecated for this model. (Type: invalid_request_error)

Prompt executed in 21.35 seconds

Cause

comfy_api_nodes/nodes_anthropic.py currently includes Opus 4.7:

CLAUDE_MODELS: dict[str, str] = {
    "Opus 4.7": "claude-opus-4-7",
    ...
}

But the node always sends temperature in the Anthropic request:

temperature = model["temperature"]
...
AnthropicMessagesRequest(
    model=CLAUDE_MODELS[model_label],
    max_tokens=max_tokens,
    messages=[AnthropicMessage(role=AnthropicRole.user, content=content)],
    system=system_prompt or None,
    temperature=temperature,
)

Anthropic's Claude Opus 4.7 migration docs say that setting temperature, top_p, or top_k to any non-default value returns a 400 error:

https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-7#sampling-parameters-removed

Suggested Fix

For claude-opus-4-7, omit the temperature field entirely. For example:

model_id = CLAUDE_MODELS[model_label]
temperature = None if model_id == "claude-opus-4-7" else model["temperature"]

Since the request serializer appears to use exclude_none=True, this should prevent temperature from being sent for Opus 4.7 while preserving the existing behavior for older Claude models.

Alternatively, the UI could hide or disable the temperature input for models that do not support sampling parameters.

Environment

  • OS: Windows
  • Node: built-in Anthropic Claude API node
  • Model selected: Opus 4.7
  • Local file path in traceback: ComfyUI/comfy_api_nodes/nodes_anthropic.py
  • ComfyUI commit/version: unknown; local install is not a git checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions