๐Ÿ 

Local Chatbot with Ollama

๐Ÿง‘โ€๐ŸŽ“ Apprenticeโฑ๏ธ 20 minutes

๐Ÿ“‹ Suggested prerequisites

  • โ€ขAPI trio completed (optional)
  • โ€ข8GB RAM minimum

What you'll build

You'll install Ollama and run an AI model directly on your computer, without internet and without API keys. You'll download a model like Llama 3.2, run it in your terminal, and chat with it. When you're done, you'll have your own local chatbot that works offline, is completely private, and has no usage costs. Ideal for sensitive data, learning how LLMs work, or simply having AI always available.


Why a local model?

Cloud (Gemini, Claude, OpenAI)Local (Ollama)
Requires internetWorks offline
Your data goes to their serversYour data stays on your machine
Pay per useFree (after download)
More powerful modelsSmaller models

๐Ÿ’ก Ideal for: sensitive data, no internet, or just learning how LLMs work under the hood.


Step 1: Install Ollama

SystemCommand
macOSbrew install ollama
Linuxcurl -fsSL https://ollama.ai/install.sh | sh
WindowsDownload from ollama.com/download

Verify installation:

ollama --version

Step 2: Download a model

ollama pull llama3.2

โณ First time downloads ~2GB. After that it's instant.


Step 3: Chat!

ollama run llama3.2

Type your message and press Enter. To exit: /bye


If something failed

ErrorCauseSolution
command not found: ollamaNot installedReinstall Ollama
model not foundNot downloadedRun ollama pull llama3.2
Very slowLow RAMUse smaller model: llama3.2:1b
FreezesInsufficient RAMClose other apps, need 8GB free

Bonus: Programmatic chatbot

Want to use Ollama from code (like you did with APIs)?

Ask any AI:

I need a Node.js chatbot that:
- Uses Ollama locally (no API key)
- Works in terminal
- Maintains conversation history

Give me the code and commands.

Ollama has a local REST API at http://localhost:11434.


What did you learn?

Cloud APILocal Model
API key requiredNo API key
Internet requiredWorks offline
Remote serverYour computer

The code is almost the same. Only the endpoint changes.


Next step

โ†’ Chat with Web UI โ€” Give your chatbot a nice face