When to run a local LLM instead of calling an API
Run a local LLM when the data cannot leave the building. In regulated fintech that covers more than most teams expect. Customer PII, transaction records, anything an auditor would ask to see. A hosted API is faster to start with, but the moment a prompt carries regulated data across a network boundary you own a compliance problem. A model running on your own infrastructure removes the boundary.
What actually forces a local model?
Four things decide it, in rough order of how often they come up.
- Data residency and compliance. If the data cannot leave a region or a network, the model comes to the data.
- Latency. A local model on the same network answers without a round trip to a third party.
- Cost at volume. Past a certain request count, your own hardware beats per-token pricing.
- Offline environments. Some systems have no outbound internet at all.
What do you give up?
Honesty first. You lose the largest frontier models, and you take on the work of running inference yourself. For a lot of fintech work that trade pays off, because a mid-size open model with good retrieval answers the real question and the data never moves.
Does local mean worse answers?
Less than you would expect. Most production quality comes from retrieval, not raw model size. I pair a local model with RAG and citation-first responses, so the answer carries its source instead of guessing from memory. A smaller model that quotes the right document beats a larger one that improvises.
How I make it simple in a React app
I got tired of rewiring the same streaming plumbing, so I built use-local-llm, a set of React hooks that stream responses from local runtimes like Ollama, LM Studio, and llama.cpp, with no server in between. It is the code version of the private-AI argument. The model runs where the data lives, and the interface streams from it directly.
The rule I use
Start local when the data is regulated or the volume is high. Start with an API when you are testing an idea and the data is safe to send. Then let the constraint, not the trend, decide when to move.