Machine Learning — entry 007 of 24

Hugging Face

Verified Jul 2026

Hugging Face's Inference Providers route requests to a network of partner GPU providers (Groq, Together, Fireworks, Replicate, and more) behind one OpenAI-compatible API and a single HF token, covering chat, image, video, and embedding models. It replaced the older standalone Inference API, offering a free tier plus extra credits for PRO and Enterprise accounts, with no markup added on top of provider rates. The Hub itself still hosts hundreds of thousands of open models and datasets alongside the inference layer.

Hugging Face's Inference Providers route chat, embedding, and image requests to a network of partner GPU providers (Groq, Together, Fireworks, and more) behind one OpenAI-compatible API, authenticated with a single HF token — replacing the older standalone Inference API.

llminferenceembeddingsnlpopen-source
AuthenticationAPI KeySign up with the provider to obtain credentials.
HTTPSSupportedTraffic is encrypted in transit.
CORSEnabledCallable directly from browser JavaScript.
PricingFreemiumA usable free tier exists, with paid plans for more volume.
FormatsJSON, ImageResponses can be requested as JSON or Image.

GreatAPIs Score

Score81out of 100
Authentication15/25API key required
Pricing17/20Freemium tier available
Docs14/20Documentation URL provided
Formats15/15Supports 2 response formats
Freshness20/20Verified within 6 months

Embed this badge

Scored 81 on greatapis.com
<a href="https://greatapis.com/api/hugging-face/"><img src="https://greatapis.com/badge/hugging-face.svg" alt="Scored 81 on greatapis.com"></a>

Auth quickstart

  1. Create a free Hugging Face account at huggingface.co
  2. Generate a fine-grained token with the 'Make calls to Inference Providers' permission at hf.co/settings/tokens/new
  3. Send it as an `Authorization: Bearer YOUR_API_KEY` header on every request
Stored keyNo key stored

Your key is stored only in this browser (localStorage) and sent directly to the API — never to greatapis.

Chat completion via the OpenAI-compatible endpoint

POSThttps://router.huggingface.co/v1/chat/completions

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "model": "openai/gpt-oss-120b:fastest",
  "messages": [
    { "role": "user", "content": "How many G's in huggingface?" }
  ]
}

200 application/json

{
  "id": "chatcmpl-abc123",
  "model": "openai/gpt-oss-120b",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "There are 2 G's in \"huggingface\"." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 15, "completion_tokens": 12, "total_tokens": 27 }
}

Developer reference

Gotchas & limits

  • The base URL is `router.huggingface.co/v1`, not the old `api-inference.huggingface.co` — the legacy standalone Inference API has been replaced by Inference Providers
  • Append `:fastest`, `:cheapest`, or `:preferred` to the model id to control provider routing (e.g. `openai/gpt-oss-120b:cheapest`) — the default policy is `:fastest`
  • The OpenAI-compatible `/v1/chat/completions` endpoint only covers chat tasks — embeddings, image, and audio tasks require the `huggingface_hub` InferenceClient or JS SDK instead