Connecting an LLM to n8n
n8n connects to AI models either through dedicated nodes (OpenAI, Anthropic community nodes) or a generic HTTP Request node calling any model's API.
The prompt
Method: POST. Body (JSON): { "model": "your-model", "messages": [{"role":"system","content":"You summarize support tickets in 1 sentence."},{"role":"user","content":"{{$json.ticket_body}}"}] }. Use an expression to pull the ticket text from the previous node.What to replace
Swap these placeholders for your own details before running the prompt:
{{$json.ticket_body}}your own value
Pro tip: Always add a "Set" node right after the AI call to extract just the fields you need — don't pass the raw API response downstream.
How to use this prompt
- Copy the prompt using the button above.
- Replace {{$json.ticket_body}} with your own details — the more specific you are, the better the output.
- Paste it into n8n / HTTP Request node and run it.
- If the answer feels generic, add constraints: audience, length, tone, and what to avoid. That single change fixes most weak output.
Learn the technique
Connecting an LLM to n8n
Module 1 — n8n Basics for AI Workflows · AI Automation with n8n
Related prompts
Auto Content Repurposing Pipeline
Trigger: new blog post published (RSS or webhook) -> AI node: generate a Twitter/X thread, LinkedIn post, and email blurb from the article -> Route each to the right channel.
Claude (inside n8n)AI Email Triage & Auto-Responder
Trigger: new email in inbox -> AI node classifies intent (support, sales, spam, urgent) -> conditional branches route to auto-reply, Slack alert, or human queue..
ChatGPT (inside n8n)Error Handling & Idempotency in n8n
Real automations fail: APIs time out, models return malformed JSON, webhooks fire twice.
Claude (inside n8n)Human-in-the-Loop Approval Gates
The highest-trust automations pause for approval at the moments that matter: before sending externally, before spending money, before deleting anything.
Any modelProject: Your First Production n8n Workflow
Deliverable: one n8n workflow, running on a schedule or trigger, that saves you real time every week. Steps: 1.
n8n + ChatGPTWeekly Automation Digest
Automated weekly team update via n8n + Slack
Topics
Related across the site
GPT vs Claude vs Gemini: An Honest Comparison
A practical comparison of the three leading AI models across writing, coding, reasoning, long documents and cost — including which one to reach for on which task, and where each genuinely falls short.
n8n and AI: Build Your First Real Automation
A practical walkthrough of wiring an AI model into an n8n workflow — the node structure, the prompt that makes it reliable, and three automations worth building first.
Prompt Engineering Fundamentals
Learn the building blocks of a great prompt — role, context, task, format, and constraints — and how ChatGPT, Claude, Perplexity, and Grok each respond differently to the same instructions.
RAG & Custom AI Knowledge
Ground AI answers in your own documents with Retrieval-Augmented Generation — from no-code Custom GPTs and Claude Projects to understanding chunking, embeddings, and retrieval quality.
Tokenizer
A tokenizer is the component that splits text into tokens before a model processes it. Different model families use different tokenizers, which is why the same text can have different token counts on GPT versus Claude.
ChatGPT vs Claude vs Perplexity vs Grok — Grok
The same task often needs a slightly different prompt style per model.