What's free
Free CPU Basic + ZeroGPU for Spaces; Inference Providers has a monthly credit ($0.10/mo on Free plan, $2.00/mo on PRO/Team/Enterprise)
Rate limits
No RPM/TPM published, only credit amounts
The catch
Credits only apply with "Routed by Hugging Face" billing, not with a Custom Provider Key
Quickstart — chat completions
from openai import OpenAI
client = OpenAI(base_url="https://router.huggingface.co/v1", api_key="<YOUR_FREE_API_KEY>")
resp = client.chat.completions.create(
model="<a-free-model>",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)…or with curl:
curl https://router.huggingface.co/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"<a-free-model>","messages":[{"role":"user","content":"Hello!"}]}'