Ep 11: Awakening the Model — Wiring LLM Credentials & Basic Chat Model Nodes

12 MIN READ | UPDATED: 2026-06-16
DIRECT SUMMARY // KEY TAKEAWAY

Learn to connect OpenAI, Claude, Gemini and local Ollama models to n8n, understand Chat Model vs AI Agent node roles, and master temperature and cost control.

From Automation to Intelligence

Episodes 1-10 had deterministic workflows — input A always produces output B. Now we introduce probabilistic LLMs, granting workflows the ability to understand language, reason, and generate content.

graph TB
    subgraph "Ep 01-10: Deterministic"
        D1[Input] --> D2[Fixed Rules] --> D3[Certain Output]
    end
    subgraph "Ep 11-30: Intelligent"
        I1[Input] --> I2[🤖 LLM Reasoning] --> I3[Dynamic Output]
        I2 -->|"May call tools"| I4[External APIs]
        I4 --> I2
    end
    style I2 fill:#ff6d5b,stroke:#e55a4e,color:#fff

1. n8n AI Node Hierarchy

graph TB
    subgraph "AI Node Architecture"
        Top[🤖 AI Agent Node
Top layer: autonomous decisions] Top --> LLM[🧠 Chat Model
Engine: OpenAI / Claude / Gemini] Top --> Memory[💾 Memory Node
Conversation history] Top --> Tools[🔧 Tool Nodes
Callable external abilities] end style Top fill:#ff6d5b,stroke:#e55a4e,color:#fff style LLM fill:#8b5cf6,stroke:#7c3aed,color:#fff
Node Role Analogy
Chat Model Engine: text in → text out Car engine
AI Agent Dispatcher: decides which tools to call The driver
Memory Stores conversation history Driver's memory
Tools External capabilities for the Agent Steering wheel / pedals

⚠️ Chat Model nodes cannot be directly wired into workflow connections. They must be embedded inside an AI Agent or LLM Chain node as sub-nodes.


2. Credential Setup

# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Getting your OpenAI API Key
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 1. Visit https://platform.openai.com/api-keys
# 2. Click "Create new secret key"
# 3. Name it "n8n-production"
# 4. Copy the key (shown only once!): sk-proj-xxxxxxxx
# 5. Paste into n8n Credentials manager
#
# ⚠️ NEVER put API Keys in workflow expressions!
# Always use n8n's Credentials manager (AES-256 encrypted)

3. Model Comparison

Provider n8n Node Recommended Model Price Strength
OpenAI OpenAI Chat Model gpt-4o Med-High Best tool calling
Anthropic Anthropic Chat Model claude-3.5-sonnet Med-High 200K context
Google Google Gemini gemini-2.0-flash Low Multimodal, cheap
Ollama Ollama Chat Model llama3.2 Free Local, air-gapped

4. Basic LLM Chain

// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Basic LLM Chain configuration
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

// System Prompt:
// "You are a product copywriter. Generate a 50-word marketing blurb
//  for the given product. Be upbeat and include one emoji."

// User Message (expression):
// "Product: {{ $json.productName }}, Features: {{ $json.features }}"

// Chat Model: gpt-4o-mini, Temperature: 0.7, Max Tokens: 200

5. Temperature Guide

Scenario Temperature Reason
Extract invoice numbers 0 Need exact, stable results
Translate documents 0.3 Accurate with minor phrasing flexibility
Marketing copy 0.7 Creative but not wild
Poetry / fiction 1.0 Maximum creativity

Next Episode

In Ep 12, we upgrade from basic LLM Chain to a full AI Agent — connecting Chat Trigger to build a multi-turn conversational bot.