AutomationBeginner

How to Connect Anthropic Claude as the Model in n8n Workflows

Add an Anthropic credential and use a Claude chat model in n8n nodes and agents so you can compare or switch providers freely.

6 minBeginner

n8n is provider-agnostic, so you are not locked into one LLM vendor. Adding Anthropic's Claude alongside OpenAI lets you pick the best model per task or fail over if one provider has an outage. This guide wires Claude in and uses it as the chat model in an AI Agent.

What you need

  • A running n8n instance
  • An Anthropic account with API access and billing enabled
  • A workflow where you want to use Claude (new or existing)

Step 1: Create an Anthropic API key

Sign in at console.anthropic.com, open API Keys, and create a new key. Copy it now, since the console only shows the full value once.

Step 2: Add the credential in n8n

In n8n go to Credentials, click Add credential, search for Anthropic, and paste your key into the Anthropic API credential. Save and let n8n test the connection.

n8n - Anthropic credential
Credential type: Anthropic API
API Key [ sk-ant-************************ ]
[ Save ] Connection: tested OK
The Anthropic API credential ready to save.

Step 3: Use a Claude chat model

In any LangChain-based flow, add an Anthropic Chat Model sub-node, choose your credential, and pick a model such as claude-sonnet-4. Connect it into an AI Agent or Basic LLM Chain exactly where you would connect an OpenAI chat model.

Swap models without rebuilding
Because the chat model is a separate sub-node, you can unplug OpenAI and plug in Claude on the same agent in seconds. Keep both credentials around to A/B test quality and cost.

Step 4: Run a quick comparison

Send the same prompt through an OpenAI model and a Claude model in two parallel branches, then eyeball the outputs side by side. This is the fastest way to decide which provider fits a given task.

n8n - Side by side output
You
Rewrite this support reply to be warmer.
Agent
Claude: I am sorry for the trouble, let me fix this for you right away...
Agent
OpenAI: Thanks for reaching out, happy to help sort this out...
Same prompt, two providers, compared in one run.

Result

Claude is now a first-class model option in your instance. Any node or agent can use it, and switching providers is a one-dropdown change rather than a rebuild.

Watch related tutorials

Tags
#n8n#anthropic#claude#credentials