# Inference API

Call hosted Hugging Face models over HTTP with an HF token (@huggingface/inference).

AI developers · Part 07: Hugging Face · Card 6 of 12 · Last updated 2026-10-13

## 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.

## Related concepts

- [Self-hosted models](https://studyvisually.com/learn/tech/ai-developers/hugging-face/self-hosting)
- [The Hugging Face Hub](https://studyvisually.com/learn/tech/ai-developers/hugging-face/hugging-face-hub)
- [Transformers.js](https://studyvisually.com/learn/tech/ai-developers/hugging-face/transformers-js)
- [pipeline()](https://studyvisually.com/learn/tech/ai-developers/hugging-face/pipeline)

Web page: https://studyvisually.com/learn/tech/ai-developers/hugging-face/inference-api
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=inference-api
