Module 06 · AI Nodes in n8n
Connecting Claude and OpenAI Nodes to a Workflow
Open lesson + course map
On this lesson
Course outline
Module 1 · Why n8n, Why Now
Module 2 · Workflow Architecture
Module 3 · Working With APIs
Module 4 · Webhooks and Triggers
Module 5 · Self-Hosting n8n
Module 6 · AI Nodes in n8n
Module 7 · Real Business Automations
Module 8 · Selling Automation as a Service
AI nodes add probabilistic generation to a deterministic workflow. Connect them only after defining the task, permitted data, provider terms, model/version, schema, evaluation, cost limits, and human approval. Node availability and model names change; verify current n8n and provider docs.
// concept
Choose the Smallest AI Task
Good first tasks: classify a synthetic enquiry into an allowed taxonomy, summarize approved public text, or draft a response for review. Avoid using a model as payment verifier, legal/tax authority, identity decision, or database authorization layer.
Create separate provider credentials with minimum access and budget alerts. Never put API keys in prompts or Code nodes. Record provider, model identifier/alias, temperature/settings where exposed, prompt version, and data controls.
Maintain a provider-change checklist covering credentials, allowed data, model availability, pricing date, context/output limits, rate quotas, evaluation results, and fallback. Switching a node is a production change, not a cosmetic replacement.
// concept
Enforce Structured Output
Request a schema:
{
"category": "sales|support|other",
"summary": "string <= 200 chars",
"needs_human": true,
"evidence_refs": ["input:message"]
}Validate after the model. Reject unknown enum, excess length, missing fields, or invented evidence. Model output cannot choose credentials or tool permissions.
// worked_example
Worked Example
A synthetic Lahore service enquiry is classified. OpenAI and Claude configurations are evaluated against the same 30 labelled fixtures. The workflow measures exact category match, unsafe claim rate, invalid JSON, latency, and estimated cost.
The selected configuration writes only a DRAFT classification. Low-confidence, unsupported, and protected topics route to human review. The business can swap provider only after rerunning the evaluation; no model is declared permanently best.
// failure_cases
Failure Cases to Diagnose
6 cases to diagnose
Entire CRM record sent
minimize input.
Model name assumed current forever
record and re-evaluate changes.
Free-form output drives branch
schema-validate.
AI marks payment paid
use provider evidence.
No provider outage path
queue or human fallback.
Cost cap absent
limit input, calls, retries, and tenant spend.
// pakistan_angle
Pakistan Angle
Do not send CNIC, bank, health, student, employee, or private customer data to an AI provider without necessity, authority, and appropriate terms. Use synthetic or redacted fixtures during development.
Test English, Roman Urdu, and code-switched messages from the intended audience. Do not infer education, religion, ethnicity, or ability to pay from language.
// hands_on
Hands-On Exercise
5 steps
Define one bounded AI task.
connect two provider nodes using protected credentials.
enforce one output schema.
run the same labelled fixtures.
set cost, retry, fallback, and human gates.
// completion_rubric
Completion Rubric
6 checks — tick as you verify
// sources
Sources
4 official sources — check every claim yourself
// check_yourself
Check yourself
4 questions · answers and options are taken word-for-word from this course
1 / 4 · diagnose
Your work shows this failure mode: “Model name assumed current forever.” What does the lesson tell you to do about it?