Serverless Inference in one line
Hugging Face Serverless Inference is a free (or Pro-boosted) shared pool that lazy-loads any Hub model on demand. The first request to a cold model returns HTTP 503 with an `estimated_time` field telling your client when to retry; warm requests return in well under a second. Rate limits are strict, apply per-token and per-model, and change without notice. Serverless is the fastest way to prototype against any of the million-plus models on the Hub without provisioning infrastructure, and it is completely wrong for production workloads with SLOs.
Inference Endpoints in one line
An Inference Endpoint is a dedicated instance of a specific model on a specific GPU SKU in a specific region. It stays warm, has predictable latency, no shared rate limits, and bills per-second — even when idle unless you enable scale-to-zero. Endpoints are the production answer: private networking, org ACLs, custom containers, autoscaling policies, and a stable inference URL that survives model updates. In exchange you accept a monthly bill that scales with wall-clock time rather than usage, and you take on the capacity-planning problem.
Pick Serverless when
- You're prototyping or building an internal demo
- Traffic is spiky, low, and can tolerate an occasional cold-load 503
- You'll test many different models before committing to one
- You're a Pro user and the quota comfortably fits your usage
- The model is small and popular enough that it stays warm in the shared pool
Pick Endpoints when
- You have production traffic with an SLO
- You hit Serverless rate limits regularly
- You need a specific GPU SKU for a specific model size
- You need private networking, VPC peering, or org-level access control
- You need custom container images or non-standard runtimes (vLLM, TGI, custom kernels)
- Predictable per-request latency matters more than absolute cost
The third option: the HF router
router.huggingface.co is an OpenAI-compatible endpoint that fans out to many hosted providers (HF, Together, Fireworks, Replicate, and more). It is useful when you want one HF token but multi-provider fallback, and when you would rather compare Serverless vs Inference Endpoints against external providers on the same billing account. The router adds a small HF margin over provider pricing but eliminates the vendor-integration tax. For teams that want provider diversity without integration overhead, it is often the best default.
Rate limits, quotas, and what they actually mean
Serverless Inference publishes a tokens-per-minute quota that varies by plan (Free, Pro, Enterprise). In practice the effective quota also depends on model popularity — a rarely-used model may be evicted from the shared pool between calls and re-loaded on demand, costing you cold starts even within quota. Endpoints have no shared quota; the limit is the physical throughput of the SKU you rent, which for TGI on an L4 with a 7B model is around 30–60 tokens/second aggregate. The router inherits its provider's limits per underlying route.
Migrating from Serverless to Endpoints without rewriting
Both accept the same model repo IDs; the client shape is very close. You swap the base URL from api-inference.huggingface.co to your endpoint URL, replace your HF token with the endpoint token, and drop any client-side retry logic that watched for the Serverless-specific 503 with `estimated_time`. Endpoints never return that shape — they either serve, queue, or 429. If you built on huggingface_hub's `InferenceClient` you can pass the endpoint URL to the same constructor and the switch is a one-line change.
Cost sanity check
- Serverless — $0 or your Pro subscription; no per-request charge
- Endpoints on an L4 always-on — ~$936/mo baseline; scale-to-zero can drop this to ~$250/mo
- Router with a Together L4-class provider — typically $0.20–$0.60 per million tokens
- Rule of thumb: Endpoints win once daily traffic exceeds a few thousand requests of a small/mid model