Most n8n users overcomplicate AI integration with complex node chains. I regularly see workflows with 10+ nodes just to call an LLM: parsing, formatting, error handling scattered everywhere. Yet, a single HTTP Request node to the Claude API does the job in 5 minutes.

In this article, I'll show you how to integrate Claude AI into your n8n workflows simply and effectively. We'll cover the complete configuration, essential parameters, concrete use cases, and advanced optimizations.

Why Claude AI?

Claude offers up to 200K tokens of context, excellent reasoning for complex tasks, a simple API, and competitive pricing with multiple models for all budgets.

Prerequisites

Before starting, make sure you have a working n8n instance (cloud or self-hosted), an Anthropic API key available at console.anthropic.com, and 5 minutes of your time.

The API key is free to create, and Anthropic offers credits to get started. Once you have the key, you can store it in n8n credentials for secure use.

HTTP Request Node Configuration

Here's the complete HTTP Request node configuration to call Claude. This is everything you need to get started:

JSON
{
  "method": "POST",
  "url": "https://api.anthropic.com/v1/messages",
  "headers": {
    "x-api-key": "{{ $credentials.anthropicApi }}",
    "anthropic-version": "2023-06-01",
    "content-type": "application/json"
  },
  "body": {
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "{{ $json.prompt }}"
      }
    ]
  }
}

Security tip

Store your API key in n8n credentials rather than hardcoding it in the workflow. Use the "Header Auth" type with the x-api-key header.

Essential Parameters

Understanding the parameters helps you optimize the quality and cost of your API calls. Here are the three key parameters to master.

The model

Anthropic offers several models depending on your needs. Model choice directly impacts quality, speed, and cost. Claude Sonnet offers the best value for most cases. Claude Opus is the most powerful for complex tasks requiring deep reasoning. Claude Haiku is the fastest and most economical for simple high-volume tasks.

JavaScript
// Available models (December 2025)
const models = {
  sonnet: "claude-sonnet-4-20250514",  // Recommended
  opus: "claude-opus-4-20250514",      // Most powerful
  haiku: "claude-haiku-4-20250514"     // Fastest
};

max_tokens

This parameter defines the maximum response length. 1024 tokens equals approximately 750 words. Adjust according to your needs to optimize costs: short response for a summary, longer for detailed analysis.

Dynamic prompt

Use n8n expressions to inject dynamic data into your prompt. This allows you to create flexible workflows that adapt to incoming data.

JavaScript
// n8n expression examples for the prompt
"content": "Summarize this text: {{ $json.article_content }}"
"content": "Translate to French: {{ $json.text }}"
"content": "Analyze this customer feedback: {{ $json.feedback }}"

Getting the Response

Claude's response arrives in a structured JSON format. To extract the generated text, use this expression in the next node. You can use it in a "Set" node to clean the output, or directly in the next node of your workflow.

JavaScript
// Expression to get Claude's response
const response = {{ $json.content[0].text }};

// Complete response structure
{
  "id": "msg_xxx",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Your generated response here..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 50,
    "output_tokens": 200
  }
}

Error handling

Remember to add an "Error Trigger" node to handle cases where the API doesn't respond or returns an error (rate limiting, quota exceeded, timeout).

Concrete Use Cases

Here are some powerful workflows you can create by combining Claude with native n8n nodes. Each example shows the node chain to use.

Automatic email summarization

Automatically summarize long emails and send a Slack notification with key points. Ideal for never missing the essentials in an overflowing inbox.

Workflow
Gmail Trigger → HTTP Request (Claude) → Slack Message

// Prompt for email summary
{
  "messages": [{
    "role": "user",
    "content": "Summarize this email in 3 key points:\n\n{{ $json.text }}"
  }]
}

Structured data extraction

Extract structured information (name, email, company, need) from raw text and automatically feed a spreadsheet. Perfect for processing forms or incoming requests.

JSON
// Prompt for structured extraction
{
  "messages": [{
    "role": "user",
    "content": "Extract the following information as JSON:\n- name\n- email\n- company\n- need\n\nText: {{ $json.message }}"
  }]
}

// Expected response
{
  "name": "John Doe",
  "email": "john@example.com",
  "company": "TechCorp",
  "need": "Report automation"
}

Scheduled content generation

Generate daily content (LinkedIn posts, newsletters, articles) and automatically save it to Notion or WordPress. You just need to review and publish.

Workflow
Schedule Trigger (9am daily)
    → Google Sheets (read topic)
    → HTTP Request (Claude generates)
    → Notion (save draft)

Productivity tip

Create a Google Sheet with a list of topics, and let the workflow generate one draft per day. You keep editorial control while automating creation.

Advanced Optimizations

Once the basic workflow is functional, here's how to improve it for even better results.

System prompt

The system prompt gives Claude a permanent context. It defines the role, tone, and constraints for all interactions. This is essential for getting consistent responses.

JSON
{
  "model": "claude-sonnet-4-20250514",
  "max_tokens": 1024,
  "system": "You are an expert technical writing assistant. Always respond in English in a concise and professional manner. Use bullet points when relevant. Never make assumptions, ask for clarification if needed.",
  "messages": [
    {
      "role": "user",
      "content": "{{ $json.prompt }}"
    }
  ]
}

Multi-turn conversation

To maintain conversation context (chatbot, assistant), pass the message history. Claude will remember the previous context.

JSON
"messages": [
  { "role": "user", "content": "Hi, I'm looking for a hotel in Paris." },
  { "role": "assistant", "content": "I can help! What are your dates and budget?" },
  { "role": "user", "content": "{{ $json.new_message }}" }
]

Temperature

The temperature parameter controls response creativity. A value of 0 gives deterministic, factual responses, while a value close to 1 favors creativity.

JavaScript
// For factual responses (extraction, summary)
"temperature": 0.2

// For creative content (writing, brainstorming)
"temperature": 0.8

// For balance (general use)
"temperature": 0.5

Watch out for hallucinations

With high temperature, Claude may generate incorrect information. For critical tasks (data, numbers), keep temperature low (0.1-0.3).

Costs and Best Practices

LLMs are billed by token volume (input + output). Understanding pricing helps you optimize your workflows.

Approximate rates for December 2025: Haiku costs about $0.25 per million input tokens, ideal for simple high-volume tasks. Sonnet costs about $3 per million input tokens, it's the sweet spot for most cases. Opus costs about $15 per million input tokens, reserved for critical complex analyses.

For a workflow processing 100 emails/day with Sonnet, expect about $1-5/month. Very reasonable compared to time saved.

Cost optimization

Reduce prompt sizes by removing unnecessary text, use caching for frequent questions, and choose Haiku for simple high-volume tasks.

Conclusion

Integrating Claude AI into n8n is really simple: a single HTTP Request node is enough. No need for complex node chains, elaborate parsing, or sophisticated error handling to get started.

The key is to start simple: a basic workflow that works, then iterate to add features. Stop building Rube Goldberg machines — one node that works is all you need to get started.

So, what will your first workflow with Claude AI be?

Resources

To go further, here are the official resources to consult:

n8n Claude AI Anthropic Automation LLM API No-Code Workflow