DEV Community

Alex Chen
Alex Chen

Posted on

Quick Tip: Run 5 Free LLMs Locally with Ollama in 3 Commands (No API Key, No Cloud)

Last month I got a $41 OpenAI bill for a side project that maybe 12 people use. That's when I decided: no more API keys for personal projects.

Turns out you can run five genuinely good LLMs locally with three commands and zero cost.

The 3 commands

# 1. Install Ollama (one line)
curl -fsSL https://ollama.com/install.sh | sh

# 2. Pull a model
ollama pull llama3.1:8b

# 3. Run it
ollama run llama3.1:8b
Enter fullscreen mode Exit fullscreen mode

That's it. No signup, no API key, no credit card.

The 5 free models I actually use

Model Size Best for My verdict
Llama 3.1 8B 4.7GB General chat, writing Daily driver
Qwen 2.5 Coder 7B 4.7GB Code generation Beats GPT-3.5 on my Python tasks
DeepSeek R1 8B 5.2GB Reasoning, math Slow but scary good
Mistral 7B 4.1GB Fast answers Best speed/quality ratio
Gemma 2 9B 5.8GB Summarization Underrated

Real numbers from my machine

On my 32GB RAM laptop (no GPU, just CPU):

  • Llama 3.1 8B: ~11 tokens/sec — usable for chat
  • Qwen Coder: ~9 tokens/sec — fine for code review
  • With a $300 used RTX 3060: 40+ tokens/sec — faster than typing

Monthly cost: $0. Previous API spend: $41/month. Savings: $492/year.

Bonus: use them in Python

import requests

r = requests.post("http://localhost:11434/api/generate", json={
    "model": "qwen2.5-coder:7b",
    "prompt": "Write a Python function to merge two sorted lists",
    "stream": False
})
print(r.json()["response"])
Enter fullscreen mode Exit fullscreen mode

No SDK, no auth headers, no rate limits. It just works.

The catch (being honest)

  • 8B models are not GPT-4. For complex refactors I still open a paid tool occasionally.
  • You need 8GB+ RAM free per model. 16GB total is the comfortable minimum.
  • First token latency on CPU is 2-4 seconds.

For autocomplete and coding, I pair local models with MonkeyCode — a free open-source AI coding assistant that plugs into Ollama directly, so completions stay 100% on my machine: https://ly.cyberserval.tech/iIETXiF


Question for you: which local model is your daily driver — and did you manage to fully cancel your API subscriptions, or do you still keep one paid tool around?

Top comments (0)