Inference API
Call hosted Hugging Face models over HTTP with an HF token (@huggingface/inference).
Last updated
Analogy
Serverless functions for models: someone else owns the GPU, you just send requests.
In an agent
Use it for bigger open models when you don't have your own GPU.
Questions people ask
What is the Hugging Face Inference API?
It lets you call models hosted by Hugging Face over HTTP with an access token, using the @huggingface/inference package. Someone else runs the GPU and you just send requests, like serverless functions for models. It suits bigger open models that you cannot run on your own hardware.
When should I use the Inference API instead of running a model locally?
When the model is too big for your server, especially larger language models that need a GPU, or when you are prototyping and do not want to manage hardware. For small, high-volume models such as embeddings, running them locally with Transformers.js is usually cheaper and faster.