Local AI · Zero API Bill

Run an LLM on your own machine.

No API bill. No data leaving your laptop. The tweet-sized promise is real — but it runs on very concrete math: bytes per parameter, memory bandwidth, and quantization. Here's how local inference actually works.

~4.2 GB7B model at 4-bit
2 bytesper param at FP16
$0.00per token, forever

The Fit-It Lab: will it run on your box?

Pick a model size and quantization. The 3D memory tower shows the model's weight blocks stacking into a GPU's VRAM (the translucent frame = your memory budget). Drag to rotate.

Drag with mouse or finger to orbit the memory tower

Quantization
Your hardware
Weights + KV cache
Est. speed
File on disk (GGUF)

The two formulas that decide everything

1

Memory: bytes × parameters

A model is just billions of numbers (weights). Storage depends on how many bytes each number takes:

memory ≈ params × bytes/param
+ ~10–20% (KV cache, buffers)

Worked example — Llama-class 8B: at FP16 (2 bytes) → 8 × 2 = 16 GB. At 4-bit (~0.56 bytes incl. scales) → ~4.5 GB. Same brain, quarter the memory.

2

Speed: bandwidth ÷ model size

Generating one token means reading every weight from memory once. Decode is memory-bandwidth-bound, so:

tokens/sec ≈ bandwidth (GB/s)
÷ model bytes (GB)

Worked example: RTX 4090 has ~1,008 GB/s. An 8B model at Q4 is ~4.5 GB → theoretical ceiling ≈ 224 tok/s; real-world ~60–70% of that. That's why smaller quants feel faster, not just lighter.

Quantization: shrinking weights without lobotomizing the model

Quantization stores each weight with fewer bits, grouped into blocks with a shared scale factor. The GGUF format (used by llama.cpp and Ollama) packages quantized weights plus tokenizer and metadata in one portable file.

Common GGUF quant levels for an 8B model
FormatBits/weight~File sizeQuality impact
FP161616.0 GBReference quality
Q8_0~8.58.5 GBVirtually lossless
Q6_K~6.66.6 GBNear-lossless
Q4_K_M~4.84.9 GBSmall, usually acceptable loss — the community default
Q2_K~2.63.2 GBNoticeable degradation; last resort

Rule of thumb: a bigger model at 4-bit usually beats a smaller model at 8-bit. 70B-Q4 > 8B-FP16 on most tasks — if you have ~40 GB of memory to hold it.

Three tools, one engine

llama.cpp

The C/C++ inference engine underneath almost everything. Runs GGUF on CPU, CUDA, Metal, Vulkan. Maximum control, CLI-first. You compile flags; it rewards you with speed.

Ollama

llama.cpp wrapped in a one-line experience: ollama run llama3.1:8b. Pulls models, manages versions, exposes an OpenAI-compatible local API on port 11434 — so existing agent code can point at localhost.

LM Studio

A desktop GUI for browsing, downloading, and chatting with GGUF models. Shows you VRAM fit estimates before download. Friendliest on-ramp for non-terminal people.

Local vs cloud API: the honest tradeoff

DimensionLocal (Ollama / llama.cpp)Cloud API
Marginal cost$0/token (you pay electricity + hardware)Per-token billing, scales with usage
PrivacyData never leaves the machineData transits provider servers
Peak qualityCapped by what fits in your RAMFrontier models, hundreds of billions of params
LatencyNo network hop; speed set by your bandwidthNetwork + queue, but huge batched throughput
Ops burdenYou manage updates, prompts, context limitsProvider handles everything

The sane strategy for an "AI agent that runs free": local model for high-volume, private, routine steps; cloud call only for the hard reasoning. That's not a hack — it's how production systems cut bills by 10× or more.

Enjoy this tool? Build your own with Super