Running LLMs Locally: The Productivity Hack Nobody's Talking About
Here's the thing nobody tells you: you don't actually need to call OpenAI or Claude every time you want to use an LLM. I spent six months hammering the API limits before I realized I could just... run one on my machine.
Why You Should Care
Cloud APIs charge per token. It's 10 cents here, 25 cents there. Add up a few hundred API calls a day and suddenly you're dropping $30-50/month on what could've been a local inference problem.
But that's not even the best part. Local LLMs:
- Run offline (no sending code snippets to some server)
- Return results in milliseconds (no network latency)
- Let you use weird models that fit your exact use case
- Work in your dev environment without an internet connection
I wasn't buying it either until I tried it. Switched to local Llama 2 for code completion, and my IDE response time went from "wait for the network" to instant.
The Setup (30 minutes)
Step 1: Get an LLM
Grab Ollama (ollama.ai) — it's the easiest path. It handles the model download, quantization, and serving automatically.
# Install Ollama, then run:
ollama pull mistral
ollama pull llama2
That's it. Mistral runs fine on 8GB RAM. If you've got 16GB, you can run Llama 2 70B with context.
Step 2: Start the Server
ollama serve
Now you've got a local API server on localhost:11434. Same format as OpenAI's API, except it's on your machine.
Step 3: Use It
curl http://localhost:11434/api/generate -d '{\"model\": \"mistral\", \"prompt\": \"Write a function to parse JSON\", \"stream\": false}'
Or use any client that supports OpenAI-compatible APIs. The point is, it just works.
Real Use Cases
Code completion — I run a smaller Mistral instance in the background while coding. When I'm stuck, I hit a keybind and get a suggestion instantly. No API call overhead.
Drafting documentation — Generate first drafts of README files, docstrings, API docs. Edit locally, no billing surprises.
Testing prompts — Building an AI feature? Test 50 variations of your prompt for free before paying for API calls to evaluate which one works best.
Privacy-sensitive work — Client data stays on your machine. No questions asked.
The Tradeoff
Local models are cheaper and faster, but they're not as smart as the biggest cloud models. Mistral is solid for coding and general tasks. For complex reasoning or specialized domains, you might hit the ceiling.
My system: use local models for 90% of stuff, reserve API calls for the 10% that needs reasoning power.
Getting Better Results
Two things make a huge difference:
1. Prompt engineering — Local models are pickier about prompts. Be explicit. Instead of "write a function," try "Write a Python function that takes a list of numbers and returns the median. Include type hints and a docstring."
2. System prompts — Set a good system message to guide the model's behavior. Something like "You are a helpful developer. Be concise. Provide code examples when relevant."
Next Steps
Once you've got local inference running, you can:
- Integrate it into your dev environment with extensions
- Build a Chatbot around it for your team
- Use it in batch jobs for bulk text processing
- Chain multiple models for complex workflows
The barrier to entry is stupidly low now. If you're spending money on APIs for routine tasks, you're leaving optimization on the table.
Try it this week. Spend 30 minutes getting Ollama running locally, then use it for one task you normally would've hit an API for. You'll either save money or learn why the cloud approach is worth it for your workflow.
Either way, you'll know.
Want to stay sharp on AI productivity trends? Check out LearnAI Weekly — real insights, no hype.
Top comments (0)