Skip to content

AI Agent with Anthropic models fails: 'temperature and top_p cannot both be specified' error #18304

Description

@Richcantoo

Bug Description

When using Anthropic Chat Model (Claude) in AI Agent node, the workflow fails with:

  • Error: Bad request - please check your parameters
  • Message: 'temperature' and 'top_p' cannot both be specified for this model

Root Cause
n8n sends both temperature and top_p parameters by default, but Anthropic's API requires only one to be set (as per their documentation: "You should either alter temperature or top_p, but not both").

To Reproduce

  1. Add AI Agent node
  2. Select Anthropic Chat Model
  3. Choose any Claude model (tested with Claude Opus 4.1)
  4. Run workflow
  5. Error occurs regardless of parameter configuration

Expected Behavior

n8n should only send either temperature OR top_p to Anthropic's API, not both.

Environment

  • n8n version: [your version]
  • Deployment: [self-hosted/cloud]
  • Node: AI Agent with Anthropic Chat Model

Workaround

Currently using HTTP Request node to directly call Anthropic API as the AI Agent node is unusable with Claude models.

To Reproduce

  1. Add AI Agent node
  2. Select Anthropic Chat Model
  3. Choose any Claude model (tested with Claude Opus 4.1)
  4. Run workflow
  5. Error occurs regardless of parameter configuration

Expected behavior

n8n should only send either temperature OR top_p to Anthropic's API, not both.

Debug Info

n8n sends both temperature and top_p parameters by default, but Anthropic's API requires only one to be set (as per their documentation: "You should either alter temperature or top_p, but not both").

Operating System

macOS 13.7.7

n8n Version

1.106.3

Node.js Version

n8n Cloud

Database

SQLite (default)

Execution mode

main (default)

Hosting

n8n cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    in linearDEPRECATEDteam:aiIssue is with the AI teamteam:nodesIssue is with the Nodes team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions