Claude is the AI behind most of the workflows I build. This guide gets you from zero to a working Claude credential in n8n -- about 5 minutes total.
Get Your API Key
- Go to console.anthropic.com and create an account
- Navigate to API Keys in the left sidebar
- Click Create Key and name it something you'll recognize later -- "n8n automation" works
- Copy the key immediately. Anthropic shows it once and never again. If you lose it, you'll need to create a new one.
Your key starts with sk-ant-. If it doesn't look like that, you're looking at the wrong thing.
New accounts get $5 in free credits. That's enough to run a daily AI news digest for weeks before you'd need to add a payment method.
Add the Credential in n8n
n8n's Anthropic nodes use a built-in credential type. No custom headers needed.
- In n8n, go to Credentials (left sidebar)
- Click Add Credential
- Search for Anthropic and select it
- Paste your API key into the API Key field
- Click Save
Every Anthropic node in your workflows (Chat Model, LLM Chain, AI Agent) can now use this credential.
If you're importing a workflow template that uses Claude, the template will prompt you to connect this credential when you first open it. Select the credential you just saved.
Choosing a Model
Anthropic offers three model tiers. Pick based on the task, not the name.
| Model | Best for | Cost (per 1M tokens in/out) | Speed |
|---|---|---|---|
| Haiku 4.5 | Batch processing, classification, extraction | $1 / $5 | Fastest |
| Sonnet 4.5 | Writing, analysis, multi-step reasoning | $3 / $15 | Fast |
| Opus 4 | Complex research, nuanced writing | $15 / $75 | Slower |
For most n8n workflows, Haiku handles 80% of the work. Summarizing articles, categorizing content, parsing structured data -- Haiku does all of this at a fraction of Sonnet's cost.
I use Sonnet for the final compilation step in digests and reports where the output quality matters more. Opus I rarely touch in automated pipelines -- it's overkill and 5x the price.
A practical pattern: run Haiku for per-item analysis (cheap at scale), then Sonnet for the final synthesis (one call, richer output).
What This Actually Costs
Real numbers from running a daily AI news digest:
- Per article analysis (Haiku): ~$0.001
- Digest compilation (Sonnet): ~$0.01-0.02
- Full daily run (25 articles): $0.03-0.10
- Monthly total: $0.90-3.00
You'll spend more on coffee this morning than Claude costs you this month.
Set a usage limit in the Anthropic console under Plans & Billing to avoid surprises. I keep mine at $10/month -- enough headroom for spikes but capped so a runaway loop can't hurt.
Using Claude in n8n Workflows
Three ways to use Claude in n8n, depending on the workflow pattern:
Chat Model node (most common) -- Drop a "Chat Anthropic" node into an AI Agent or LLM Chain. Select your credential and model. The node handles message formatting, system prompts, and response parsing.
LLM Chain -- Connect a Chat Model to a Basic LLM Chain node for simple prompt-in, text-out flows. Good for batch processing where you don't need tool calling.
AI Agent -- Connect a Chat Model to an AI Agent node for multi-step reasoning with tools. The agent can call other n8n nodes as tools, making decisions about what to do next. More powerful, but costs more tokens per run.
Configuration Tips
- Temperature: Default 0.7 works for most tasks. Drop to 0.2 for classification and extraction (you want consistency). Push to 0.9 for creative writing tasks.
- Max tokens: Set this in the Chat Model node. Haiku and Sonnet default to 4096. For short outputs (categories, scores, one-line summaries), drop it to 500-1000 to save cost and prevent rambling.
- System prompts: Put your instructions in the system prompt, not the user message. Claude follows system prompts more reliably, and you can reuse the same system prompt across items in a batch.
Troubleshooting
"Invalid API key" error -- Double-check you pasted the full key starting with sk-ant-. Common mistake: copying the key name instead of the key value.
"Overloaded" or 529 errors -- Anthropic's servers are at capacity. This happens occasionally with Sonnet during peak hours. Set Retry on Fail to 3 with a 10-second interval on the node. Or switch to Haiku for that step, which rarely gets overloaded.
"Max tokens exceeded" -- Your input is too long. Either truncate the input text before sending it to Claude, or check that your output max_tokens isn't set too low (all current Claude models handle 200K input tokens).
Costs higher than expected -- Check the Anthropic usage dashboard. Most of the time it's a bug sending the same item to Claude in a loop. Set a hard monthly limit in billing settings.
See the AI News Digest for a full working workflow using this setup, or check Anthropic's pricing page for current rates.