Lección 5 · Módulo 2: Your First Working AI Automation
Running free local models with Ollama for zero per-call cost
- Run Ollama on your own computer
- Connect it to an n8n workflow
- Choose a model and know its limits
Why this matters
Each message a business receives, such as a booking request or a price question, can trigger an AI call that someone pays for. At small volumes the fee is tiny, but it grows with every customer and lands hardest in the busiest weeks. This lesson shows how to run an open model on your own computer with Ollama, so the workflow you build in n8n can classify and sort messages with no per-call charge.
Key ideas
A model is a file, and a runner loads it. A model is a large file of learned settings, often called parameters. On its own it does nothing. Ollama is the free program that loads that file into memory and answers requests from other programs.
Local means no per-call fee, but not no cost. Running the model on your PC removes the charge for each call. Electricity and your time still cost something, and a weak computer may be slow.
The workflow reaches Ollama at one address. n8n sends each message to http://localhost:11434, the port Ollama listens on. The reply returns along the same path, and nothing leaves your machine.
Cost grows with volume on hosted models. A worked example at 0.002 dollars per message:
| Messages a month | Hosted cost | Ollama cost |
|---|---|---|
| 300 | 0.60 dollars | 0 dollars |
| 3,000 | 6 dollars | 0 dollars |
| 30,000 | 60 dollars | 0 dollars |
Small models such as Llama 3.2 3B run on an ordinary laptop, while larger ones need more memory and run slower.
Try it before you watch
A hosted model charges 0.002 dollars per message. How much would a business pay each month for 1,500 messages, and what would it pay with a local Ollama model?
Show answerHide answer
1,500 × 0.002 = 3 dollars a month on the hosted model. With Ollama the per-call price is zero, so the fee is 0 dollars; only electricity and your time remain. It shows that the hosted bill is simply messages multiplied by the price per call.
Words to know
- Model: a large file of learned settings that lets an AI system read text and produce answers.
- Ollama: a free program that loads a model on your computer and answers requests from other programs.
- localhost: the address that means "this computer only"; a program using it cannot be reached from another machine.
- Port: a numbered door on a computer that a program listens at, such as 11434 for Ollama.
- Parameters: the individual numbers inside a model that hold what it learned; a "3B" model has about 3 billion of them.
- Hosted model: an AI model that runs on another company's servers, and you pay for each call.
What to watch for
- Watch the
localhostwarning and notice why a cloud-hosted n8n cannot reach a model on your PC. - Watch the cost table build up as the message count grows, and compare the hosted line with the zero line.
- Watch which model is chosen for which job, and why you should test on your own real messages before trusting the output.
Apréndelo con tu tutor en la pizarra en vivo
Puntos clave del video
A per-call bill
- A customer message is a small job
- Hosted AI bills every single call
- Running the model yourself removes that fee
layout: full
parts:
ai: {chip: AI, sub: "Hosted model"}
chat: {chat: "Do you have a slot on Friday?"}
chat2: {chat: "What is the price of a colour?"}
steps:
- at: "Do you have a slot"
send: chat
- at: "price of a colour"
send: chat2
- at: "read each message and sort it"
vortex: {into: ai, words: [booking, price, hours, complaint]}
- at: "run on someone else's computers"
highlight: ai
- at: "pay a small fee for every call"
note: "Fee for every call"
- at: "hosted AI tools are priced"
highlight: ai
- at: "three thousand messages a month"
count: {to: 3000, label: messages}
- at: "remove that per-call fee"
note: "No per-call fee" What you will learn
- Run Ollama on your own computer
- Connect it to an n8n workflow
- Choose a model and know its limits
tree:
Three goals: [Run Ollama, Connect to n8n, Choose a model]
direction: down
start: none
steps:
- at: "three things"
show: Three goals
- at: "Run Ollama"
show: Run Ollama
- at: "Connect to n8n"
show: Connect to n8n
- at: "Choose a model"
show: Choose a model
- at: "work out what it costs"
note: "Your own cost, with real numbers" Ollama runs the model
- A model is a large file of settings
- Ollama loads the file and answers requests
- It downloads once and then works offline
layout: full
parts:
model: {chip: Model, sub: "A file of settings"}
app: {window: ollama, holds: [model], code: ["ollama run llama3.2", ">>> Is Friday free?"]}
pc: {box: Your PC, holds: [app], icon: monitor}
steps:
- at: "large file of learned settings"
highlight: model
- at: "Ollama is the program"
type: app
- at: "without asking anyone"
zoom_out: pc Connecting n8n to Ollama
- The workflow sends the message to localhost
- Ollama passes it to the model
- The reply comes back the same way
layout: side
direction: LR
components:
wf: {kind: service, label: n8n workflow}
ollama: {kind: llm, label: Ollama server}
model: {kind: model, label: llama3.2}
zones:
- {label: Your PC, contains: [ollama, model]}
links: [wf->ollama, ollama->model]
steps:
- at: "In n8n you add"
show: [wf]
- at: "which is the address your own computer"
show: all
note: "http://localhost:11434"
- at: "The workflow sends the message"
flow: ["wf>ollama: localhost", "ollama>model", "model>ollama", "ollama>wf: reply"]
- at: "Nothing leaves your machine"
highlight: [ollama, model] Choosing a model
- Small models run fast and light
- Bigger models handle longer writing
- Test on real messages first
tree:
Pick a model: ["[Short task] Llama 3.2 3B", "[Longer writing] Llama 3.1 8B", "[Very hard task] Hosted model"]
direction: down
start: none
steps:
- at: "Start with the small one"
show: [Pick a model, Llama 3.2 3B]
- at: "Llama three point one, eight B"
show: Llama 3.1 8B
- at: "a hosted model"
show: Hosted model
- at: "test it on your own real messages"
highlight: Llama 3.2 3B The cost formula
- The bill is messages times the price per call
- Local Ollama sets the price per call to zero
- Electricity and your time still cost something
layout: side
objects:
e1: {tex: 'C = n \times p', pos: top}
e2: {tex: 'C = 3000 \times 0.002 = 6', pos: top}
e4: {tex: 'C = n \times 0 = 0', pos: bottom}
e5: {tex: 'C = n \times 0 + \text{electricity and time}', pos: bottom}
steps:
- at: "The monthly bill is"
show: e1
- at: "Then three thousand messages"
morph: [e1, e2]
- at: "six dollars a month"
highlight: e2
- at: "the price per call is zero"
show: e4
- at: "Electricity and your own time"
morph: [e4, e5] How the bill grows
- The hosted bill grows with messages
- The Ollama cost stays at zero dollars
- From three hundred to thirty thousand messages
layout: side
objects:
a: {tex: 'C = 300 \times 0.002 = 0.60', pos: top}
b: {tex: 'C = 3000 \times 0.002 = 6', pos: top}
c: {tex: 'C = 30000 \times 0.002 = 60', pos: top}
z: {tex: 'C = n \times 0 = 0', pos: bottom}
steps:
- at: "three hundred times zero point zero zero two"
show: a
- at: "Three thousand messages gives six dollars"
morph: [a, b]
- at: "Thirty thousand messages"
morph: [b, c]
- at: "The Ollama cost stays at zero dollars"
show: z Common mistake: localhost
- localhost means this computer only
- A cloud n8n cannot reach your PC
- Same machine, or a server n8n can reach
layout: side
direction: LR
components:
cloud: {kind: service, label: n8n in the cloud}
ollama: {kind: llm, label: Ollama on your PC}
zones:
- {label: Internet, contains: [cloud]}
- {label: Your PC, contains: [ollama]}
links: [cloud->ollama]
steps:
- at: "localhost means this computer"
show: [ollama]
highlight: [ollama]
note: "localhost = this PC only"
- at: "host n8n in the cloud"
show: all
highlight: [cloud]
- at: "runs in Docker"
note: "Docker: use host.docker.internal"
- at: "switched off or asleep"
highlight: none
note: "The PC must be on"
- at: "Either run n8n on the same machine"
highlight: none
note: "Same machine, or a server n8n can reach"
- at: "works on your PC but fails in the cloud"
highlight: none
note: "Check the address first" Recap
- The model is a file on your disk
- Ollama runs it on your PC
- Three things to remember
layout: full
parts:
model: {chip: Model, sub: "A file of settings"}
ollama: {box: Ollama, holds: [model], icon: server}
pc: {box: Your PC, holds: [ollama], icon: monitor}
steps:
- at: "The model is a file"
highlight: model
- at: "Ollama runs it"
zoom_out: ollama
- at: "on your own PC"
zoom_out: pc
- at: "Three things to remember"
spokes: {of: pc, items: [Zero per call, n8n can reach it, Check the output]}
- at: "before you trust it"
highlight: pc Your exercise
ollama pull llama3.2
ollama list
ollama run llama3.2 Transcripción
A per-call bill. Picture a small hair salon. Customers message the owner all day. Do you have a slot on Friday? What is the price of a colour? An AI model can read each message and sort it, and a workflow can send the reply. Most of those models are hosted, which means they run on someone else's computers, and you pay a small fee for every call. That is how most hosted AI tools are priced. Each fee is tiny, but three thousand messages a month adds up as the business grows, and the bill climbs in the busiest weeks. In this lesson you will remove that per-call fee by running the model on your own computer.
What you will learn. By the end of this lesson you will be able to do three things. First, run Ollama on your own computer. Ollama is a free program that holds an AI model and answers questions for other programs. Second, connect to n8n, so your workflow sends messages to that local model instead of a paid service. Third, choose a model and know its limits, so you trust it with the right jobs. Each step builds on tools you have already met in this course. You will also work out what it costs, with real numbers.
Ollama runs the model. Let's slow down and look at the model itself. A model is a large file of learned settings, often called parameters. Think of it as a trained assistant's knowledge, written down as numbers. The file does nothing alone. Ollama is the program that loads it into your computer's memory and answers requests. Think of Ollama as a DVD player and the model as the disc. You type one command, the model downloads once, and after that it works on your own computer without asking anyone's permission. The model you will use is about two gigabytes, which fits on a normal laptop.
Connecting n8n to Ollama. So how does a workflow reach a model on your PC? In n8n you add the Ollama Chat Model node to the AI step you built in the earlier lesson. That node points at localhost, on port one one four three four, which is the address your own computer uses to talk to itself. The workflow sends the message to the Ollama server, and Ollama passes it to the model. The reply comes back along the same path. There is no account to sign up for and no key to paste. Nothing leaves your machine, and no one charges you per call.
Choosing a model. Now choose a model for the job. Start with the small one. Llama three point two, three B has about three billion parameters, so it is fast and light, and it runs on an ordinary laptop with a few gigabytes of free memory. It handles sorting a message into booking, price, hours or complaint very well. For longer writing, like a reply that needs more care, step up to Llama three point one, eight B, which is bigger and slower. For very hard reasoning, a hosted model may still be the honest choice. Whichever you pick, test it on your own real messages first, because a model that looks clever on a demo can still mislead on your customers.
The cost formula. Here is the arithmetic, written out, so you can check it yourself. The monthly bill is the number of messages, n, times the price of each call, p. Suppose a hosted model charges zero point zero zero two dollars per message. Then three thousand messages costs three thousand times that price, which comes to six dollars a month. Six dollars does not sound scary, but it grows with every customer. With Ollama, the price per call is zero, so the same sum gives zero. Electricity and your own time still cost something, but no per-call fee does.
How the bill grows. Let's look at how the bill grows from three hundred to thirty thousand messages. Take a quiet month with three hundred messages. The hosted cost is messages times the price, so three hundred times zero point zero zero two is sixty cents. Three thousand messages gives six dollars. Thirty thousand messages, a busy month for a growing business, gives sixty dollars. Look at the three answers together and the gap grows with the business. The Ollama cost stays at zero dollars in every month, because nothing is billed per call. That gap is what you save.
Common mistake: localhost. This is the mistake that breaks most first attempts. Your workflow says localhost, and localhost means this computer and no other. If you host n8n in the cloud, its server looks for Ollama on its own machine, finds nothing, and the run fails. Your Ollama lives on your PC, so the cloud cannot reach it. If n8n runs in Docker, localhost points inside the container, so use host dot docker dot internal instead. The same trouble hits when your PC is switched off or asleep. Either run n8n on the same machine as Ollama, or host Ollama on a server n8n can reach. Check this first whenever a local workflow works on your PC but fails in the cloud.
Recap. Let's put the lesson together. The model is a file of learned settings. Ollama runs it, and it does so on your own PC, not on a company's server. That single choice removes the per-call fee, because nothing is billed for each message your PC answers. Sorting and summarizing messages is exactly the kind of work a small local model handles well. Three things to remember. First, zero per call, although electricity still costs something. Second, n8n must be able to reach Ollama: the same machine, or a server it can reach. Third, check the output on your own messages before you trust it.
Your exercise. Now it is your turn, and it should take one sitting. Install Ollama from its official website. Then open a terminal, the text window where you type commands, and type the three lines on screen. The first downloads llama three point two. The second lists what you have installed, so you can see the model is really there. The third starts a chat with it. Ask it to sort five of your own messages into booking, price, hours or complaint, and note how many it gets right. Finally, multiply your own monthly message count by the price you pay now, and write the answer down. Keep your results, because you will reuse them when you test the workflow.
Explora las animaciones
Las animaciones del video, exactas y en vivo: reprodúcelas, pausa, arrastra el control deslizante o salta a un paso a tu propio ritmo.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Responde todas las preguntas y luego comprueba. Apruebas con 70%; puedes intentarlo las veces que quieras.
Resumen de la lección
- Lectura
- Video visto
- Cuestionario aprobado (70%)
- The model is a file on your disk
- Ollama runs it on your PC
- Three things to remember