*.hf.space URL, Git-push deploys, and time-sliced access to an Nvidia RTX Pro 6000 Blackwell against a 5-minute daily GPU quota — plus any number of Static Spaces. Everything else, including a CPU-only Gradio Space and any Docker Space, now needs PRO ($9/mo) or a Team/Enterprise plan.Spaces was the most under-used free platform in AI hosting, and the 2026 paywall narrows it to a single lane: two ZeroGPU Gradio demos and as many static pages as you like. It was never a generic VPS, a 24/7 backend, or a place for a multi-page Next.js app. Used in its lane, it replaces a pipeline that would cost $20-50/month on Render or Railway.
Free Tier at a Glance
| Resource | Free Tier Includes | Notes |
|---|---|---|
| What you can create free | Static Spaces (unlimited) + 2 Gradio Spaces on ZeroGPU | Gradio and Docker Spaces otherwise "require a paid plan to create" |
| "Good standing" | Verified email, account older than 30 days | The condition on the 2 free ZeroGPU Spaces |
| Hardware | CPU Basic: 2 vCPU, 16 GB RAM | No hourly cost — but creating a compute Space on it needs PRO |
| Storage | 50 GB ephemeral disk | Lost when the Space restarts or stops; persist via Storage Buckets |
| Bandwidth | Unmetered (fair use) | No published hard cap |
| Build minutes | Unmetered | Triggered by every Git push |
| Sleep policy | Sleeps after 48 hours idle | Docs: "currently, 48 hours". First visit wakes it; cold start ~30-90s |
| Outbound network | Ports 80, 443 and 8080 only | "Any requests going to other ports will be blocked" |
| GPU access | ZeroGPU — Nvidia RTX Pro 6000 Blackwell | 48 GB (large, default) or 96 GB (xlarge, 2x quota cost) |
| ZeroGPU daily quota | 5 min free / 40 min PRO | 2 min unauthenticated; PRO can extend at $1 per 10 min |
| ZeroGPU Spaces you may host | 2 free / 10 PRO / 50 Team-Enterprise | Quota is pooled per account across them |
| Region | Not user-selectable | No region picker on Spaces hardware |
| Commercial use | Allowed | No non-commercial clause, but the free tier gives no uptime guarantee |
| Custom domain | PRO or Team & Enterprise | Free Spaces serve from *.hf.space only |
| Visibility | Public, protected or private | Protected (private code, public app) is a PRO / Team & Enterprise feature |
| SDKs offered | Gradio, Docker, static HTML | ZeroGPU is "exclusively compatible with the Gradio SDK" |
The short version: the free tier is now a ZeroGPU tier. Two Gradio Spaces, a shared GPU metered at 5 minutes a day, and unlimited static pages. For a hobby demo run a few times a day that is still genuinely free forever — it is just no longer the open-ended CPU allowance it was.
How Spaces Works
Every Space is a Git repo on huggingface.co. You push code, the Hub builds a Docker image, and a container starts behind a public hf.space URL. Two design decisions make it unusual:
- Git is the deploy interface. No
deployCLI, no build panel — push tomainand the Space rebuilds, the way Vercel, Netlify, and Cloudflare Pages work, except Hugging Face hosts the Git remote itself. - Weights live on the Hub, not in your image. A 7B model is 14 GB. Instead of bundling it, the SDK pulls weights at runtime via
huggingface_hub, cached on a shared layer so rebuilds don't re-download.
The result fits the shape of an AI demo, not a generic web app.
The ZeroGPU System
ZeroGPU is what makes Spaces different from every other free host — and since the paywall it is the only free way to run code here. You don't reserve a GPU; your Space declares which functions need one, and a scheduler allocates a pooled GPU for the duration of that call:
- Your Space runs on the CPU container by default.
- Functions decorated with
@spaces.GPUget pulled into a GPU worker when invoked. - Each call counts against your daily quota, measured in seconds of actual GPU time: 5 minutes a day free, 40 for PRO, 2 for an unauthenticated visitor.
- The hardware is an Nvidia RTX Pro 6000 Blackwell — half of one (48 GB) at the default
largesize, all of one (96 GB) atxlarge, which burns quota twice as fast. - Cold-start to a GPU worker is typically under 5 seconds, often under 2.
- Gradio only. The docs are explicit that ZeroGPU Spaces "are exclusively compatible with the Gradio SDK" — the old Docker +
spaces-package route no longer applies. - A free account in good standing may host 2 ZeroGPU Spaces; PRO raises that to 10 and Team/Enterprise to 50.
This works because AI demos are bursty — a model runs inference for a few seconds, then sits idle while a human reads the output. ZeroGPU multiplexes those bursts across many Spaces, charging quota only for compute seconds. For a hobbyist, that still means a real image-gen demo, a Whisper tool, or a fine-tuned 7B chatbot on a public GPU-backed URL, at no cost — within 5 minutes of GPU time a day.
Pick an SDK
- Gradio — the default for ~90% of Spaces, and the only SDK a free account can run code on (on ZeroGPU, 2 max). Deepest ZeroGPU integration: one decorator. Best for demos with sliders, image/audio inputs, or a chat UI.
- Docker — for anything the framework SDKs can't do: FastAPI backend, custom React frontend, non-Python runtime. Must listen on port 7860. Paid plan required to create, and no ZeroGPU.
- Static — a single-page HTML demo with no server (transformers.js, WebGPU). No container, no cold start, no quota — and still free for everyone, which makes it the fallback when the paywall blocks you.
- Streamlit and JupyterLab — the Streamlit SDK page is still up (port 8501, not 7860), but the Spaces overview now lists only three SDK options, and a Streamlit Space runs on compute like any other, so the paid-plan rule applies. Treat it as legacy.
Deploy Your First Space (Gradio)
Create a free account at huggingface.co/join, choose New Space, pick Gradio + Public, and select ZeroGPU as the hardware — on a free account that is the only hardware that will let you create it, and it counts against your allowance of 2. (CPU Basic still costs nothing per hour, but creating a Space on it now requires PRO.) You now have a Git repo. Clone it and add code:
git clone https://huggingface.co/spaces/your-name/your-space
cd your-space
app.py:
import gradio as gr
from transformers import pipeline
pipe = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
def classify(text):
result = pipe(text)[0]
return f"{result['label']} ({result['score']:.2%})"
demo = gr.Interface(
fn=classify,
inputs=gr.Textbox(label="Your text"),
outputs=gr.Textbox(label="Sentiment"),
title="Sentiment Analysis Demo",
examples=["I loved this movie.", "The plot was a mess."],
)
if __name__ == "__main__":
demo.launch()
requirements.txt:
gradio
transformers
torch
Then push:
git add app.py requirements.txt
git commit -m "Initial sentiment demo"
git push
Within 30-60 seconds the Space builds and your demo is live at your-name-your-space.hf.space. The Hub generates a TLS URL, pulls the weights automatically, and serves the app behind a queue. Every subsequent git push redeploys. No dashboard, no DNS step.
Using ZeroGPU: One Decorator, One Setting
DistilBERT runs fine on free CPU. ZeroGPU earns its keep on models that need a GPU — Stable Diffusion, Whisper, Llama 3, Flux. To enable it: switch hardware to ZeroGPU in settings, add the spaces package to requirements.txt, and decorate the heavy function:
import gradio as gr
import spaces
import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
torch_dtype=torch.float16,
).to("cuda")
@spaces.GPU(duration=60)
def generate(prompt: str):
image = pipe(prompt, num_inference_steps=25).images[0]
return image
demo = gr.Interface(
fn=generate,
inputs=gr.Textbox(label="Prompt"),
outputs=gr.Image(label="Generated"),
)
demo.launch()
Three things to notice:
duration=60is the max seconds the call may hold the GPU (default 60). Set it lower for fast functions so quota accounting is accurate, higher for slow ones to avoid timeouts.- The pipeline loads at module level, outside the decorated function — ZeroGPU moves the loaded model to the GPU worker on call, then back. Load once, dispatch many times.
- Quota is consumed in seconds of actual runtime: a 4-second generation costs 4 seconds, not 60. Free quota resets every 24 hours.
Limits and Gotchas
- You cannot create a free Docker Space any more. This is the change that breaks most older tutorials, this one included until now. Gradio and Docker Spaces "require a paid plan to create"; the only free compute left is 2 Gradio Spaces on ZeroGPU, plus unlimited Static Spaces.
- Sleep after 48h idle. The next visitor triggers a 30-90s cold start. Fine for personal demos; there's no free "always-on" setting.
- Outbound traffic is limited to ports 80, 443 and 8080. Anything else is blocked — so a Space cannot reach a Postgres on 5432, a Redis on 6379, or an SMTP server on 587. Use the HTTP API of the service instead.
- Storage is ephemeral. The 50 GB disk is lost whenever the Space restarts or stops. The old $5/mo Persistent Storage add-on has been replaced by Storage Buckets (S3-like, free to create with a free allowance, per-TB above it); an external store (Supabase, Neon, S3, a Hub dataset) works too. Hub-pulled weights are cached and not re-downloaded.
- Port 7860 is hardcoded. Gradio does this by default; Docker Spaces must
EXPOSE 7860. - Public repos by default. Never hardcode keys — use Settings → Secrets, which injects them as env vars at runtime without committing them.
- Quota is a per-account pool shared across all your ZeroGPU Spaces. One busy Space starves the others. PRO's 8x quota (40 min/day, extensible with credits at $1 per 10 min) is the main reason heavy demo-shippers upgrade.
- No custom domain on free. You get
username-spacename.hf.space. Custom domains are a PRO / Team & Enterprise feature, and never work on private Spaces.
Spaces vs Alternatives
- vs Google Colab — Colab gives an interactive T4 notebook, but no public URL others can hit. Use Colab to experiment; use Spaces to share the result.
- vs Replicate — Replicate serves a model as a per-second API with no UI (and no free tier). Spaces ships the UI; Replicate ships the API.
- vs Modal — Modal is Python-native serverless GPU with monthly free credits and no built-in UI. Spaces is "AI demo on a GPU"; Modal is "Python function on a GPU."
- vs Ollama — Ollama runs models locally, fully private, on your own hardware. Use it for local/private work; use Spaces when you need a public URL.
- vs Cloudflare Workers AI — Workers AI serves a fixed catalog of pre-deployed models; you can't upload a fine-tune. For your own trained model, Spaces is the only option of the two.
Decision tree
- Share an AI demo with a public URL? → Spaces
- Private API endpoint billed per call? → Replicate or Modal
- 24/7 production backend with custom domain + SLA? → Render, Railway, or a real cloud
- Free GPU for personal experimentation only? → Google Colab or Kaggle
- Keep weights and inference private? → Ollama on your own hardware
What the Free Tier Comfortably Handles
- Demo a fine-tuned model — a 50-line Gradio chat +
@spaces.GPU= a public 7B chatbot in 20 minutes. - Image generation — Stable Diffusion, Flux, Kandinsky: pipeline at module level,
@spaces.GPUon generate,gr.Imageoutput. - Whisper transcription —
openai/whisper-large-v3; a ZeroGPU worker does ~30 min of audio in ~30s. Pairs with the free Whisper APIs we benchmarked. - RAG Q&A — a free embedding model + in-memory Chroma + a free LLM, chunks held in RAM. See our free vector database guide for production alternatives.
- Side-by-side model comparison — two pipelines, one input, two columns.
For anything past toy demos, instrument with a free tracing layer like Langfuse — a few import lines wrap every model call for prompt, completion, latency, and cost.
Frequently Asked Questions
Can I still create a free Docker Space?
No. Since 2026 the Hub docs state that "Gradio and Docker Spaces run on compute and require a paid plan to create: PRO for personal accounts, Team or Enterprise for organizations." Duplicating someone else's Space follows the same rule. What remains free: Static Spaces for everyone, and up to 2 Gradio Spaces on ZeroGPU for personal accounts in good standing.
Do I need a credit card?
Not for the two free paths — a Static Space, or a Gradio Space on ZeroGPU — which work on accounts with no payment method. Any other Space that runs code now needs PRO ($9/mo) for a personal account, or a Team/Enterprise plan for an organization.
Is ZeroGPU really free, and what GPU is it?
Yes, within a daily quota: 5 minutes of GPU time on a free account, 40 on PRO, 2 for unauthenticated visitors, resetting 24 hours after your first use. The hardware is an Nvidia RTX Pro 6000 Blackwell — not the A100 it used to be — with 48 GB of VRAM at the default large size and 96 GB at xlarge, which consumes quota twice as fast. You don't pick the GPU; the scheduler assigns one when your @spaces.GPU function is invoked.
Can I use Spaces as a backend API?
Sort of. A Gradio app exposes a REST endpoint at /api/predict, and a Docker Space can expose any FastAPI route — but the Docker route is now a paid plan, and the free tier gives no uptime guarantee. If customers pay to call this API, host on Replicate, Modal, or a real cloud.
How do I add an API key without leaking it?
Space → Settings → Variables and secrets → New secret. It's exposed as an environment variable at runtime and never enters the Git repo. This is how you wire in OpenRouter, Together AI, or any paid API.
Getting Started
- Sign up for Hugging Face — 60 seconds.
- Create a new Gradio Space and select ZeroGPU — the free path, capped at 2 such Spaces. If you only need a browser-side demo, pick Static instead; those stay free and uncapped.
- Push the sentiment snippet above and watch it deploy. Add
@spaces.GPUwhen the model needs the GPU. The price stays zero, against a 5-minute daily quota.