Hugging Face moves Inference Providers to OpenRouter: what changes
Hugging Face now routes language-model requests in Inference Providers through OpenRouter. Your code and prices stay the same, but your own provider keys stop working for chat models. Here is what changed and how to use it with Claude Code.

On this page
Hugging Face announced on November 16, 2026 that it has replaced its own router for Inference Providers with OpenRouter's. Requests to language models now go through OpenRouter, which picks a provider for each call based on live price, speed and reliability and retries on another provider if the first one fails. Your code and token stay the same, and Hugging Face says prices don't change. The one breaking change: you can no longer use your own API key for a provider with chat models.
What changed
Inference Providers is Hugging Face's API for calling models hosted by outside inference companies with one Hugging Face token. Until now, Hugging Face's own router picked one provider for each request. If that provider failed, you got its error.
From November 16, chat and language-model requests go through OpenRouter's router instead. According to Hugging Face's announcement:
- OpenRouter picks the provider with "the best mix of price, speed and reliability," based on live measurements across its traffic, not only the lowest list price.
- When a provider slows down or starts failing, traffic moves away from it until it recovers. A failed try is retried on the next provider within the same call.
- Routing is cache-aware: a conversation stays on the provider that holds its prompt cache.
- Every open-weight model on the Hub that a provider serves can be called through the same API with your Hugging Face token.
Image, video and audio generation are not affected. They keep running directly through Inference Providers, not OpenRouter.
What stays the same, and what breaks
| Before | Now | |
|---|---|---|
| Endpoint and token | router.huggingface.co, Hugging Face token | Same |
| Provider choice | Hugging Face's router, one provider per request | OpenRouter's router, with retries on another provider |
| Pricing | Provider's price, no Hugging Face markup | Same |
| Your own provider API key (language models) | Supported | No longer supported |
| Your own provider API key (image and video) | Supported | Still supported |
| Image, video and audio generation | Direct through Inference Providers | Same, not routed through OpenRouter |
How to control routing
By default the router balances price, speed and reliability. You can change that with a suffix on the model id. These are the examples from Hugging Face's announcement:
zai-org/GLM-5.3 # default: best mix of price, speed and reliability
zai-org/GLM-5.3:fastest # highest throughput
zai-org/GLM-5.3:cheapest # lowest price
zai-org/GLM-5.3:novita # only NovitaA few other controls:
- Turn providers off. In your Inference Providers settings you can switch off any provider, and the router never sends your requests there. Organizations have the same settings, and they apply to every request billed to the organization.
- Keep a conversation on one provider. Send a stable UUID per conversation in the
X-HF-Session-Idheader so follow-up turns hit the same provider's prompt cache. The prompt caching docs say the official Python and JS clients do this automatically. - See where requests went. Model pages have new Providers and Metrics tabs with each provider's price, speed and uptime over the last 24 hours, and your usage overview breaks spend down by provider.
Using it with Claude Code
Because the router accepts Anthropic-format requests for every chat model, you can point Claude Code at open-weight models. The Hugging Face guide for Claude Code gives two options. The simplest is the hf-claude extension for the hf CLI, which shows a model and provider picker:
export HF_TOKEN="hf_..." # token with the "Make calls to Inference Providers" permission
hf extensions install hf-claude
hf claudeOr set the environment variables yourself:
export ANTHROPIC_BASE_URL="https://router.huggingface.co"
export ANTHROPIC_AUTH_TOKEN="${HF_TOKEN}"
export ANTHROPIC_API_KEY="${HF_TOKEN}"
export ANTHROPIC_DEFAULT_FABLE_MODEL="zai-org/GLM-5.3"
export ANTHROPIC_DEFAULT_OPUS_MODEL="zai-org/GLM-5.3"
export ANTHROPIC_DEFAULT_SONNET_MODEL="zai-org/GLM-5.3"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="zai-org/GLM-5.3"
export CLAUDE_CODE_SUBAGENT_MODEL="zai-org/GLM-5.3"
claudeThe ANTHROPIC_DEFAULT_*_MODEL variables map to Claude Code's model slots, so you can put different open models in each one. To bill a Team or Enterprise organization, the guide says to add ANTHROPIC_CUSTOM_HEADERS="X-HF-Bill-To: <your-org>". Hugging Face also has setup guides for Codex, OpenCode, Pi and Hermes Agent.
Keep in mind that Claude Code is Anthropic's tool and is designed around Claude models. Another model can run it through this API, but how well it works depends on how well that model handles Claude Code's tools and prompts.
Pricing and credits
According to Hugging Face's pricing page, you pay the provider's rate with no Hugging Face markup:
| Account | Monthly credits | Pay as you go |
|---|---|---|
| Free | None | Yes, after buying credits |
| PRO | $2.00 | Yes |
| Team or Enterprise | $2.00 per seat, shared by the organization | Yes |
The credits are general compute credits, so they can also go toward Inference Endpoints, Spaces hardware and Jobs.
Why open-weight models, and the numbers behind it
Hugging Face's announcement backs the move with OpenRouter's own usage data. These figures come from OpenRouter, as quoted by Hugging Face, and we haven't checked them independently:
- Open-weight models went from 26.8% of tokens served on OpenRouter in October 2025 to 71.7% at the end of September 2026, after peaking at 77.5% in July.
- Open-weight models cost about four times less on average: $0.28 per million input tokens and $1.62 per million output, against $1.27 and $6.36 for closed models.
- OpenRouter serves more than 800 trillion tokens a month to over 10 million users, across 600+ models from 80+ providers.
- OpenRouter says its rebuilt routing cut capacity errors by 46% and improved time to first token by 16.9%.
Hugging Face is also clear about the limits. Citing the Artificial Analysis Intelligence Index, it says the best open-weight model, Kimi K3.1 Pro, scores 46 against 65 for Claude Fable 5.2, at about a seventh of the cost per task. Open models are cheaper, not better at the hardest work. (Our Fable 5.2 launch post covers that model's prices and benchmarks.)
What's next
Hugging Face calls this "the first step" of the partnership. Two things are planned, with no dates given: connecting your OpenRouter account to Hugging Face, and routing more tasks through OpenRouter.
Bottom line
If you call chat models through Hugging Face Inference Providers, you don't need to change any code, and failed calls now retry on another provider. If you used your own provider API keys for language models, that stopped working, so move that spend to your Hugging Face account or switch the providers you don't want off in settings. And if you want to try open-weight models in Claude Code without setting up another account, hf claude is now the quickest way.
Sources
Written by
HelloAITech Team · Editor
We cover the latest announcements and features in AI, with a special focus on Claude and Anthropic, and write practical guides to help you put them to work.
