Local LLM vs API cost: compare the assumptions first

Calculate local hardware, idle power, API tokens, retries, and cost per accepted result with a transparent hypothetical worksheet and capacity gates.

AILocal modelsCostsComparisons

Sources are linked in the guide. Read our editorial policy.

On this page 7 sections

A local LLM is not automatically cheaper because it has no per-token invoice, and an API is not automatically cheaper because it avoids a GPU purchase. Compare the cost of producing an accepted result at the quality, privacy and response time your workload requires.

This is an original assumptions worksheet grounded in official documentation read on November 11, 2026. No hardware was benchmarked, no power draw was measured, and no model-quality or savings result is claimed. Every number in the worked example is hypothetical, including API rates, hardware cost, electricity and success rate. It is not a vendor quote or a recommendation to buy hardware.

For an implementation starting point, see the Ollama listing and local AI learning path. The Ollama vs vLLM guide addresses a different question: which runtime fits your workload once operating inference is a plausible choice.

Make the alternatives comparable

Write down a unit of useful work, not just a token count. For example: “Extract invoice number, date, currency and total from a known text document; validate the fields; route ambiguous cases to a reviewer.” Count a result as accepted only when it meets the same criteria on both paths.

Gate Local inference Hosted API
Required behavior Does the chosen model meet the extraction, reasoning, tool or modality requirement? Does the selected model and endpoint meet the same requirement?
Data boundary Verify local execution, logs, tools and network dependencies Review provider terms, account settings, retention and required region
Memory and context Fit weights, KV cache, runtime overhead and concurrency Check context limits, request limits and any long-context price tier
Response target Measure loading, queueing, time to first token and completion Measure network, queueing, service tier and completion
Operational owner Someone owns runtime upgrades, access control and failures Someone still owns integration, quotas, retries and provider failures

Do not assume an 8-billion-parameter local model and a hosted model provide interchangeable outputs. Quantization can also change behavior. Cost comparisons are conditional until you evaluate correctness on representative inputs.

Ollama’s FAQ distinguishes local execution from its cloud models and documents OLLAMA_NO_CLOUD=1 for local-only mode. Its hardware documentation makes support dependent on the platform, driver and backend. A locally installed client is not evidence that every request stays on your machine.

Use the VRAM calculator and VRAM/context guide to estimate a supported decoder-only memory budget before shopping. Replace illustrative model settings with the exact architecture. Memory fit is not a speed, compatibility or quality benchmark.

Use two ledgers: incremental cash and full ownership cost

An existing workstation may have a small incremental cash cost for one evening’s experiment. That does not make buying and operating a dedicated machine equally cheap. Conversely, charging the full purchase price to one month’s workload can overstate its monthly ownership cost.

Cost bucket Local ledger API ledger
Hardware Allocated depreciation or rental, including required host components Usually contained in service rates; include any separate client infrastructure
Energy Whole-system active and idle draw, cooling if material Client infrastructure energy if material to the decision
Model usage No hosted token charge for genuinely local execution; model license may impose conditions Ordinary input, cache reads/writes, output and other billable tokens
Services Storage, backups, gateway, monitoring and any external tools Tools, retrieval, storage, gateway and service-specific charges
People Setup, updates, security, incidents and review Integration, quota management, incidents and review
Failures Repair attempts, fallback API calls and wasted capacity Repair attempts, billed retries and fallback calls

Keep shared costs consistent: include the same application or reviewer cost on both sides, or explicitly exclude it from both. Add asymmetric work separately. Do not count an unused subscription allowance as cash savings unless it actually displaces a payment; its opportunity cost can still matter.

For a machine kept on all month, one convenient power decomposition is:

monthly energy cost = idle kW × powered-on hours × electricity rate
                    + (active kW - idle kW) × active hours × electricity rate

monthly local cost = allocated hardware + energy + operations
                   + other services + fallback charges

This assumes active power is at least idle power and active hours are part of the powered-on hours. If you shut the machine down between jobs, use the actual powered-on schedule rather than a full month of idle power. Use measured whole-system draw, not a GPU’s advertised power limit.

For API rates expressed per million tokens:

monthly API cost = sum over all attempts of
                   (ordinary input × input rate
                    + cache reads × read rate
                    + cache writes × applicable write rate
                    + output × output rate) / 1,000,000
                   + tool, storage and other applicable charges

Use disjoint billing buckets to avoid charging the same input twice. The OpenAI rate card separates input, cached input, output and applicable write tiers, while Anthropic’s caching documentation distinguishes cache creation and reads. Match the exact model, context tier, platform and date. A repeated prompt is not proof of a cache hit.

Worked example: 10,000 document tasks per month

These are invented planning inputs, not observed performance or provider prices. Assume both configurations eventually produce 9,000 accepted results from the same 10,000 logical tasks. Across successes and failures, each configuration makes 12,500 model attempts. Each API attempt uses 2,000 uncached input tokens and 500 output tokens. For this example there are no cached tokens or extra tool charges.

Assumption Hypothetical value
API ordinary input / output rates $2 / $8 per million tokens
Allocated local hardware cost $1,440 net cost over 24 months = $60/month
Local operations allocation 1 hour/month at $50/hour = $50/month
Powered-on schedule 720 hours, including 100 active hours
Whole-system idle / active draw 80 W / 220 W
Electricity $0.20/kWh
Accepted outputs 9,000 on each path, assumed rather than measured

The $1,440 is an assumed allocatable machine cost after any residual value, not a real GPU or workstation price. The 100 active hours are a capacity assumption to test, not a claim that a named model can process these tasks in that time. Common application and review costs are excluded from both paths; add any difference discovered during evaluation. API-specific operational work is assumed zero here solely to isolate the arithmetic, not because APIs require no maintenance.

The API arithmetic is:

per attempt = (2,000 × $2 + 500 × $8) / 1,000,000 = $0.008
monthly cost = 12,500 × $0.008 = $100
cost per accepted result = $100 / 9,000 ≈ $0.0111

The full local ownership arithmetic is:

idle baseline = 0.08 kW × 720 h × $0.20 = $11.52
additional active energy = (0.22 - 0.08) kW × 100 h × $0.20 = $2.80
monthly cost = $60 + $50 + $11.52 + $2.80 = $124.32
cost per accepted result = $124.32 / 9,000 ≈ $0.0138

Under these assumptions, the API ledger is lower by $24.32 per month. That is a result of the invented inputs, not a finding that hosted inference is cheaper. For an already-owned workstation that would remain on anyway, incremental electricity alone would instead be $2.80, before any incremental work, wear, upgrades or fallback charges. Labeling that narrower cash comparison prevents confusing it with full ownership cost.

Enter the API example in the LLM cost calculator using rates 2 and 8, 2,000 ordinary input tokens, zero cache buckets, 500 output tokens, 12,500 requests and no additional retry multiplier. The request count already includes the assumed attempts; applying retries again would double-count them. The calculator estimates API usage, not depreciation or local electricity.

Break-even depends on capacity and accepted outputs

With the example’s idle baseline, let fixed local cost F be $121.52: hardware, operations and idle energy. The extra active energy per attempt is v = $2.80 / 12,500 = $0.000224. Let the API’s total variable cost per attempt be a = $0.008.

F + Q × v < Q × a
Q > F / (a - v), only when a > v

This produces a crossover above roughly 15,600 attempted calls per month, if active time scales linearly, the powered-on schedule still fits, quality stays equal, and operations and hardware allocation do not change. It is not a universal token threshold. A larger GPU, second server, extra operator work or different model can change the fixed cost abruptly.

Now change just the quality assumption: if the local path accepts only 7,000 results at the same $124.32, its cost per accepted result becomes about $0.0178. The API example remains about $0.0111 for 9,000 accepted results. Spending less per generated token cannot repair that outcome. If failed local tasks fall back to the API, charge both attempts and count the accepted result once.

Different tokenizers also produce different token counts for the same document. Preserve the original task corpus and acceptance criteria rather than forcing the same numeric token count onto different models. For multi-turn agents, use the prompt-caching ledger to count every repair and delegated call.

A decision table before you spend

Situation Starting hypothesis Evidence needed to overturn or accept it
A few unpredictable requests on hardware you would otherwise buy API evaluation first Real monthly volume, required model behavior and current rate card
Repeated local experiments on an already-owned compatible machine Local evaluation is reasonable Incremental power, memory fit and accepted-output quality
Stable high utilization with an operations owner Model full local ownership cost Measured sustained capacity, queueing, reliability and maintenance
Strict offline boundary Local configuration is a gate, not a cost win Model license, disabled cloud paths, local dependencies and actual network behavior
Bursts exceed local capacity API or a deliberately budgeted hybrid Queue target, overflow volume, fallback cost and data-policy approval
Workload needs capabilities the local model cannot meet API or another suitable model Same acceptance tests; do not waive correctness to hit a cost target

For a hybrid, decide which requests can leave the machine before adding fallback. A sensitive task must not silently become an API request when local memory is exhausted. If choosing a coding agent rather than a serving stack, use Cursor vs Claude Code vs Codex to account for permissions and workflow, not just model rates.

What to measure in a small pilot

Record the exact model revision, quantization, runtime, hardware, context settings and date. Measure cold and warm requests separately. Keep rejected and timed-out tasks in the cohort. For local inference, capture wall-clock active time and whole-system power; for APIs, reconcile usage with the bill rather than estimating invisible work as zero.

The final worksheet needs monthly cost, accepted outputs, review time, tail latency and failure rate for each configuration. If any selection gate fails, stop treating the cheaper arithmetic path as deployable. Blank measurements are more useful than a fictional break-even promise.

Primary sources and research date

Sources were read on November 11, 2026. This is the research date, not a price guarantee or benchmark date.

  • Ollama FAQ: local versus cloud execution, local-only controls, model placement and memory behavior.
  • Ollama hardware support: platform, backend and driver constraints.
  • Ollama pricing: distinction between running on your own hardware and cloud usage credits. No real subscription or model price is used in the worked example.
  • OpenAI API pricing: model-specific billing categories, context and service tiers. Example rates above are hypothetical, not copied from this rate card.
  • Anthropic prompt caching: cache reads, creation, lifetimes and model-specific prices.
Connected by shared topics