How to Connect Claude to n8n (AI Agent Setup Guide)

Claude is the reasoning engine behind a great n8n agent — it reads, decides and writes. Here is how to connect it and get reliable, structured output every time.

July 13, 2026 · 6 min read

Get your Anthropic API key

Create an account at Anthropic, generate an API key, and keep it somewhere safe. This key is what lets n8n call Claude on your behalf.

Add Claude credentials in n8n

In n8n, open Credentials, add your Anthropic key, then drop an AI/LLM node into any workflow and select it. Claude is now available as a reasoning step anywhere in your automations.

Write prompts that return reliable output

The secret to a dependable agent is a tightly-scoped prompt. Always specify three things: the task, the input (piped from the previous node), and the exact output format. For example: 'Classify this email as sales, support or spam. Return only one word.'

Use structured output for downstream nodes

When the model's answer feeds another node, ask for JSON with named fields. That way n8n can route on `intent` or write `company` to a sheet without fragile text parsing.

Add guardrails

Never let a model act unchecked. Add an IF node after Claude to gate actions on confidence or category, and start in draft/preview mode. Guardrails turn a clever demo into a production agent.

Want to see it in practice? Browse every recipe that uses Claude, or start with building your first agent.

See Claude-powered recipes →

Frequently asked questions

Which Claude model should I use?

For most agent tasks a fast model is plenty and keeps costs low; use a larger model only for genuinely hard reasoning. Start small and upgrade the specific steps that need it.