Skip to main content
← Guides

API or local inference

Planning

Four axes decide it — cost structure, data and compliance, latency and throughput, model capability and updates. A decision table narrows it to one route.

What this guide covers

"API or local" is not a technical preference but a trade-off across four constraints: cost structure, data and compliance, latency and throughput, model capability and updates. If any one of them is a hard constraint, the route is largely decided. This guide quotes no specific prices; per-token and hardware prices follow the official pages.

One: cost structure

RouteMain costCheaper when
APIper token / per call, linear with usagelow or spiky volume; no GPU purchase
LocalGPU / memory / power / operations, fixed upfronthigh long-term volume; hardware already owned
Hybridlocal baseline + API for peaksclear peaks and troughs, with data that can be split

Method: estimate monthly input + output tokens, multiply by official unit prices, then compare with GPU depreciation + power + operations time. Do not compare unit prices alone — include idle time; a local GPU depreciates even when idle.

Two: data and compliance

  • Data stays in-domain: local or private deployment is the only route that can promise raw data never leaves.
  • API data terms: read training use, retention, cross-border transfer and sub-processor lists, not just the "no training" line.
  • Compliance duties: serving the public may trigger filing, content labelling and safety evaluation duties; running locally does not exempt you.

Three: latency and throughput

  • API: latency depends on the network and provider queues; peak hours may be rate-limited.
  • Local: latency depends on the GPU, quantisation tier and concurrency; throughput improves with batching and tensor parallelism.
  • Interactive: time-to-first-token matters more than total throughput.
  • Batch: total throughput and unit cost matter more; queuing is acceptable.

Four: model capability and updates

  • Frontier capability: closed APIs usually get new models and product surfaces first (Deep Research, agents, image lines).
  • Control and reproducibility: local weights can pin a version and quantisation tier, which suits regression tests and offline environments.
  • Upgrade cost: API upgrades are usually invisible; local upgrades mean re-downloading, re-quantising and re-testing VRAM.

Decision table

Your hard constraintChoose
Raw data must never leave the intranetlocal / private deployment
Need the newest frontier capability without buying GPUsAPI
High long-term volume with GPUs already ownedlocal
Clear peaks with splittable datahybrid
Need pinned versions for regressionlocal
No operations teamAPI first

Common misreads

  • Mistaking "local" for "cheap": at low volume, GPU depreciation and operations usually cost more than API calls.
  • Mistaking "API does not train" for "data does not leave the country": training and cross-border transfer are separate clauses.
  • Mistaking "it runs" for "it handles concurrency": a single-machine demo and production throughput are different things.
  • Ignoring quantisation loss: local deployments often drop tiers to fit VRAM, changing quality and context length.

Sources

SourceURL
OpenAI · API Pricing (official per-token pricing entry)https://openai.com/api/pricing/
Anthropic · Pricing (official per-token pricing entry)https://www.anthropic.com/pricing
vLLM official docs (local/self-hosted inference engine)https://docs.vllm.ai/
llama.cpp official repository (local GGUF inference)https://github.com/ggml-org/llama.cpp
Ollama official docs (local model runner)https://docs.ollama.com/

Source snapshot: 2026-11-03; item-specific rechecks and their scope are recorded in the text or source notes. Features and terms may change; check the original sources before use.