Lesson 18medium10 min
Changing the Brain: Comparing and Connecting LLMs
Connect chat model sub-nodes to the AI Agent and evaluate OpenAI, Claude, and local Ollama.
Learning Objectives
- Connect an OpenAI or Anthropic Chat Model sub-node
- Configure temperature, model IDs, and API credentials
- Understand how to swap to a local Ollama model without breaking workflow structure
Changing the Brain: Comparing and Connecting LLMs
The AI Agent node requires an attached Chat Model sub-node connected to its purple Model input port.
Option A: OpenAI Chat Model (Recommended)
- Connect the OpenAI Chat Model node to the AI Agent model port.
- Model:
gpt-4oorgpt-4o-mini. - Temperature:
0.2(Low temperature ensures adherence to tool instructions and reduces hallucinations). - Configure your OpenAI API key credentials.
Advertisement
Option B: Anthropic Chat Model
- Connect the Anthropic Chat Model node.
- Model:
claude-3-5-sonnet-latest. - Anthropic models excel at complex instructions and detailed report formatting.
Option C: Ollama (Local & Free)
For complete privacy:
- Connect the Ollama Chat Model node.
- Base URL:
http://localhost:11434 - Model:
llama3.1:8borqwen2.5:7b.
Because n8n abstracts models behind standard LangChain interfaces, you can swap the model node at any time without reconfiguring your tools or prompts.