Hugging Face, End to EndLesson 70 of 75

Module 8 · Depending on it, and publishing so others can

Renting the compute instead of owning it

In this lesson

  • 8 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 5 of 10 in this chapter

This chapter’s goalState what a model’s licence permits for your intended use and where the question is unresolved rather than answered, choose between a provider, a dedicated endpoint and your own hardware on stated cost and privacy grounds, judge a model with thirty examples of your own, and publish work a stranger can audit and reproduce.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmWatch2:03Not available
Full audiobookNot availableNot available
Cost a day: serverless against one rented card0501000200millions of tokens a dayUS dollars a day—— Serverless, billed per token– – One rented GPU, kept busyOrder-of-magnitude figures rather than quotes, and the rates move. The shape is what transfers:per-token billing is a line through the origin, a rented card is flat until you need a second one, andthe crossover sits much further right than teams assume. It moves right again by however idle the cardis, because idle costs the same as busy.
Order-of-magnitude figures rather than quotes, and the rates move. The shape is what transfers: per-token billing is a line through the origin, a rented card is flat until you need a second one, and the crossover sits much further right than teams assume. It moves right again by however idle the card is, because idle costs the same as busy.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 9Free · no account needed
Lesson steps

The Hub as a router

Many model pages carry an inference widget and a code snippet that calls a hosted API. Behind it sits a router: Hugging Face forwards your request to one of several third-party providers (Together, Fireworks, Replicate, SambaNova, Cerebras and others) under a single token and a single bill.

Python
from huggingface_hub import InferenceClient

client = InferenceClient(api_key=os.environ["HF_TOKEN"])

out = client.chat_completion(
    model="Qwen/Qwen2.5-7B-Instruct",
    messages=[{"role": "user", "content": "Summarise this in two lines: ..."}],
    max_tokens=200,
)
print(out.choices[0].message.content)

The interface is OpenAI-compatible, so the openai package pointed at the router’s base URL works unchanged, which matters, because it means switching between a hosted model, a local llama.cpp server and a provider is a change of base URL rather than a rewrite.

There is a small monthly credit on free accounts and a larger one on paid; beyond that you are billed at the provider’s rates with no markup, which is stated on the pricing page and worth re-reading, since these arrangements change.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Image Generation, in Practice exam.

Stuck on something?Ask Arjun, your AI tutor

How to cite: Addaly (2026) ‘Renting the compute instead of owning it’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/inference-providers (Accessed: 29 November 2026).