TutorialPractitioner7 min read

n8n AI nodes for marketers: models and structured output

Use n8n AI nodes for marketing work: connect models, classify and extract text, and get structured JSON output that downstream nodes can trust.

Dipuck Jones
Written by Founder of MentionX · 13+ years in B2B SaaS growth and SEO
Reviewed
Short answer

n8n's AI nodes let you drop a model into any workflow. For marketing, the reliable wins come from narrow tasks with structured output: classify this, extract that, summarise into these fields. Keep prompts specific and outputs machine-readable.

Key takeaways
  • Use the narrowest AI node that fits: classifier, extractor, then chain, then agent.
  • Ask for structured JSON so IF and Switch nodes can act on the result.
  • Model usage is billed separately from executions, by the provider or through Gateway credits.
  • Test prompts on pinned data before running on real volumes.

Checked 4 November 2026 (CET) against n8n documentation and the n8n pricing page. n8n ships updates often and node options, plan limits and prices change, so confirm in your own instance and on the pricing page. "Our view" marks MentionX opinion. Ledgerline is a fictional company used for illustration.

01How do AI nodes work in n8n?

Most AI nodes are cluster nodes: a root node does the job (classify, extract, chain, agent) and sub-nodes plug in the model, memory, tools or output parser. You pick a chat model sub-node for your provider, such as OpenAI, Anthropic or Google Gemini, and attach your credential.

The same root node can use different models. That makes it easy to compare a cheaper model with a stronger one on the same pinned data.

02How do you pay for model usage?

Two ways:

  1. Your own API keys. You create credentials with the provider and pay them directly.
  2. Gateway credits. According to the n8n Gateway credits docs, on n8n Cloud Starter and Pro (from version 2.36.0), Gateway credits let you use OpenAI, Anthropic, Google Gemini, Brave Search and Firecrawl without your own API keys. Top-ups expire after 12 months, and Gateway credits are separate from the AI Assistant credits listed on the pricing page.

Either way, model usage is separate from n8n executions. A workflow that classifies 300 leads uses one execution but 300 model calls, so lesson 19 covers estimating both.

03Writing prompts that work in workflows

Prompts in workflows differ from chat prompts. Nobody reads the answer before the next node acts on it. Rules that help:

  • State the role and the task in one line. "Classify this B2B form answer into one category."
  • Define every category or field. The Text Classifier uses category descriptions; write them as if for a new colleague.
  • Give a "none" option. Models guess when forced to choose.
  • Ask for short outputs. Fewer tokens, fewer surprises.
  • Keep brand facts in one place, such as a data table or a Set node at the top, and reference them.

The Claude prompt library has prompts you can adapt into workflow prompts.

Our view: if a task can be done with a classifier or extractor, don't use an agent. Narrow nodes are cheaper, faster and easier to test.

04Data you shouldn't send to a model

Check your company's AI policy and the provider's data terms. As a default, don't send sensitive personal data, contracts or anything confidential unless it's approved. The Claude governance lesson has a policy checklist that applies to any provider.

05Which AI node for which job?

JobNodeOutput
Sort items into categories (intent, sentiment, topic)Text ClassifierOne output branch per category, plus optional Other
Pull fields out of text (company, budget, product mentioned)Information ExtractorStructured fields per your schema
Score toneSentiment AnalysisSentiment categories
Summarise or rewrite with a fixed promptBasic LLM Chain, optionally with a Structured Output ParserText or JSON
Answer using tools, choose steps itselfAI Agent (lesson 9)Text or JSON, after tool calls
Call a provider's specific featuresProvider nodes such as OpenAI or PerplexityProvider response

06Structured output: why it matters

Text is hard to route. JSON is easy. If a model returns {"mentions_brand": true, "position": 2}, an IF node can act on it. The Structured Output Parser sub-node defines the shape. According to its docs, you can generate a schema from a JSON example (every field is treated as required) or write a JSON Schema by hand; $ref references aren't supported.

The Text Classifier has an Enable Auto-Fixing option that sends a parsing error back to the model to fix. That helps, but it costs another model call, so design prompts to get it right first time.

07A sub-node gotcha

The n8n docs warn that in sub-nodes, expressions always resolve to the first item. If you put {{ $json.name }} inside a sub-node parameter and five items arrive, every call sees the first name. Put per-item data in the root node's prompt field, not in sub-node settings.

08Choosing a model per task

TaskTypical choiceWhy
Classification with clear categoriesSmaller, cheaper modelShort outputs, easy to test
Extraction from forms or reviewsSmaller or mid modelStructured, checkable
Summaries of reportsMid modelNeeds some judgement
Drafting customer-facing copyStronger modelLess editing
Agents with several toolsStronger modelBetter tool choice

Always test on your own data. Rankings in public benchmarks don't tell you how a model handles your form answers.

09Debugging bad AI output

  1. Open the execution and read the exact prompt the node sent, including expressions resolved.
  2. Check whether per-item data actually reached the model (the sub-node first-item gotcha).
  3. Shorten the prompt; long prompts hide the instruction that matters.
  4. Add one or two examples of good output.
  5. Lower the temperature for extraction and classification.
  6. Only then try a different model.

10Worked example: Ledgerline's review mining

Ledgerline is a fictional accounts-payable software company. Details are illustrative.

Ledgerline's product marketer had 300 G2-style reviews (from their own customer survey, used with consent) and wanted themes and quotable lines for the website.

She built the extractor above, comparing two models on the same 20 pinned reviews. The cheaper model handled product areas well but marked too many quotes as usable. She kept it for extraction and added a rule: no quote went on the website without a person reading it in context and checking permission.

The output sheet fed a monthly "voice of customer" summary, which the team drafted with Claude.

Walkthrough

  1. Create credentials for your model provider (OpenAI, Anthropic, Google Gemini or another), or on Cloud Starter/Pro check whether Gateway credits cover what you need.
  2. Pin sample data: 10 short customer reviews (invented or anonymised).
  3. Add an Information Extractor. Text: {{ $json.review }}. Schema from attribute descriptions: product_area (which part of the product is mentioned), praise (one sentence), complaint (one sentence or empty), quote_ok (true if usable as a testimonial without edits).
  4. Attach a chat model sub-node with a low temperature.
  5. Run and compare output to the reviews. Rewrite descriptions where the model got it wrong.
  6. Add a Text Classifier after it with categories for your product areas, Other branch on.
  7. Write the results to a sheet for the product marketing team.

11Try it yourself

Build the review extractor above with ten invented reviews. Run it three times and note any differences between runs. Tighten the attribute descriptions until the output is stable, then test with two deliberately ambiguous reviews.

12Quick quiz

1. What does the Structured Output Parser do?

Answer: It makes the model return fields that match a JSON schema you define.

2. Why might every AI call in a loop see the same name?

Answer: The expression is in a sub-node parameter, which resolves to the first item.

3. Who can use Gateway credits?

Answer: n8n Cloud Starter and Pro, according to the docs.

13What should you check before the next lesson?

  • You have a model credential or Gateway credits.
  • Your AI outputs are structured JSON.
  • Low-confidence items go to a person.

Next: The AI Agent node, tools and memory. Or return to the n8n for Marketers track.

14Common questions

Which model should I use? Test two on your own examples. Cheaper models often handle classification well; drafting needs stronger ones.

Can I use Claude in n8n? Yes, through the Anthropic chat model node with an API key, or Gateway credits on eligible Cloud plans.

Are model calls counted as executions? No. The execution is the workflow run; model usage is billed by the provider or Gateway credits.

Questions people ask

3 answers

Which model should I use?

Test two on your own examples. Cheaper models often handle classification well; drafting needs stronger ones.

Can I use Claude in n8n?

Yes, through the Anthropic chat model node with an API key, or Gateway credits on eligible Cloud plans.

Are model calls counted as executions?

No. The execution is the workflow run; model usage is billed by the provider or Gateway credits.

Sources

  1. n8n Docs, Structured Output Parserdocs.n8n.io
  2. n8n Docs, Text Classifierdocs.n8n.io
  3. n8n Docs, Information Extractordocs.n8n.io
  4. n8n Docs, Gateway creditsdocs.n8n.io
  5. n8n, Plans and pricingn8n.io
  6. n8n Docs, How memory worksdocs.n8n.io
  7. All accessed 4 Nov 2026.
Written and reviewed by Dipuck JonesHow we research and testReport an error

Keep learning

All n8n →