Free guide
Hugging Face Now Runs on OpenRouter: What Changed and How to Use It
On November 16, 2026, Hugging Face switched the chat models on its Inference Providers API from its own router to OpenRouter's. Your token and code stay the same, but a failed request now gets retried on another provider. Here's how it works, what it costs and how to set it up.

The short version
- Chat model calls on Hugging Face Inference Providers now run through OpenRouter. Before, Hugging Face picked one provider and returned its error if it failed. Now the request is retried on another provider in the same call.
- Add :cheapest (lowest price) or :fastest (highest throughput) to the model id, or a provider name like :novita to pin one. You can switch off any provider in your Hugging Face settings.
- The catch: for chat models you can no longer use your own API key for a provider. Image and video provider keys keep working.
How it actually works
An open model is a recipe, and providers are food trucks
Open-weight models are published on the Hugging Face Hub, so any company can serve them. Many chat models are served by more than one provider, each with its own price and speed. In Hugging Face's own example, deepseek-ai/DeepSeek-V4.1-Flash had four providers on November 11, 2026, from $0.4 to $1.2 per million output tokens.
OpenRouter picks the truck for each order
OpenRouter routes requests across more than 80 providers. Its router tracks each provider's real price, latency, throughput and error rate, and sends each request to the best mix of price, speed and reliability. When a provider slows down or starts failing, traffic moves away from it until it recovers.
If truck one is swamped, the order walks to truck two
Before this change, Hugging Face's own router picked one provider and returned that provider's error if it failed. Now a failed try is retried on the next best provider inside the same call. Routing is also cache-aware: a conversation stays on the provider that holds its prompt cache.
What OpenRouter measured
When OpenRouter switched its own traffic to this routing in October 2026, it ran a one-week test against its old price-only router on more than 24 million requests. The share of requests that hit a capacity error fell 46% (from 7.1% to 3.8%), for 6.0% more cost per request. That was OpenRouter's own test on its own traffic, not a comparison with Hugging Face's old router.
How to set it up
1.Make a token with the right permission
Go to huggingface.co/settings/tokens and create a token with the "Make calls to Inference Providers" permission. You don't need an OpenRouter account. Free accounts have no included credits and need to buy some; PRO accounts get $2 of credits a month.
export HF_TOKEN="hf_..."2.Try a model in the browser first
Open any supported model page on the Hub and chat with it in the widget. The new Providers tab lists every provider OpenRouter can send that model to, with input and output price, speed and uptime over the last 24 hours. View code gives setup steps for curl, Python, JavaScript and coding agents.
3.Point Claude Code at an open model
Hugging Face's docs recommend the hf-claude extension, which shows a model and provider picker and launches Claude Code with the right settings. Or set the variables by hand. Replace zai-org/GLM-5.3 with any model on Inference Providers.
hf extensions install hf-claude hf claude # or by hand: export ANTHROPIC_BASE_URL="https://router.huggingface.co" export ANTHROPIC_AUTH_TOKEN="${HF_TOKEN}" export ANTHROPIC_API_KEY="${HF_TOKEN}" 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" claude4.Pick cheapest, fastest or one provider
Add a suffix to the model id. No suffix uses the default routing (best mix of price, speed and reliability, with failover). :cheapest picks the lowest price, :fastest the highest throughput, and a provider name pins that provider only, which also turns off failover to others.
zai-org/GLM-5.3 # default zai-org/GLM-5.3:cheapest # lowest price zai-org/GLM-5.3:fastest # highest throughput zai-org/GLM-5.3:novita # only Novita5.Switch off providers you don't want
In huggingface.co/settings/inference-providers, turn 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. Your usage overview shows spend broken down by provider.
# OpenAI-style clients use the same token: base_url="https://router.huggingface.co/v1" api_key=$HF_TOKEN
The fine print
- Pricing: you pay the provider's price on your Hugging Face bill, and Hugging Face says it adds no markup. PRO users get $2 of credits a month; Team and Enterprise get $2 per seat; Free users get none.
- Breaking change: for chat models you can no longer use your own API key for a provider. Requests are billed to your Hugging Face account or organization. Custom keys for image and video providers keep working.
- Image, video and audio generation do not go through OpenRouter; they work as before.
- 160 models from 38 labs are available this way at launch, which OpenRouter says is every model it serves that has a page on the Hub. Not every model has more than one provider.
- The 46% and 6% figures are from OpenRouter's own October 2026 test of its new router against its old price-only router, not an independent test.
FAQ
Do I need an OpenRouter account to use this?
No. You use your Hugging Face token and get billed by Hugging Face. Hugging Face lists connecting an OpenRouter account as a next step, so it isn't available yet.
Does my code have to change?
No. Both companies say your token, endpoint and code keep working. The router supports OpenAI's Chat Completions and Responses APIs and Anthropic's Messages API for every chat model.
What do :cheapest and :fastest do?
:cheapest sends the request to the provider with the lowest price. :fastest sends it to the provider with the highest throughput in tokens per second. With no suffix, the router balances price, speed and reliability and fails over if a provider breaks.
Is Hugging Face Inference Providers free?
Not for heavy use. Free accounts have no included credits and must buy credits. PRO accounts get $2 of credits each month, and Team and Enterprise organizations get $2 per seat. Beyond that you pay the provider's price.
Can I use Claude models this way?
No. Claude Code is only the tool here. You point it at an open model on Hugging Face, like zai-org/GLM-5.3, and that open model does the work.
Sources
- Hugging Face blog: Hugging Face and OpenRouter join forces
- OpenRouter: OpenRouter Now Powers Inference on Hugging Face
- OpenRouter: How we rebuilt provider routing
- Hugging Face docs: Claude Code with Inference Providers
- Hugging Face docs: Pricing and Billing
- Hugging Face Inference Providers settings
Checked November 16, 2026 against the Hugging Face blog post and its source file, OpenRouter's November 16 announcement and October 28 routing post, and the Hugging Face Inference Providers docs for Claude Code and pricing.
Want help building with tools like this?
Join the Shipping Skool community free. Paid members get live bootcamp calls every week and weekly-updated courses.
Join Shipping SkoolMore free guides
Chrome DevTools MCP: Let Your Coding Agent See the Page It Builds
Google's free, open-source way to give your coding agent a real Chrome window and the DevTools you already use. What it does, how it works, how to set it up, and the fine print.
GPT-6.2 Drops Its Reasoning When You Edit Old Messages: How to Keep It
Every reasoning item is now tied to the conversation before it. Edit that history and the API drops the reasoning that follows. Here's how it works and how to keep it.
Inkling 2 Mini: Run Thinking Machines' Looped AI Model on Your Mac
Thinking Machines' new open-weights model runs on a 32GB Mac with the wifi off. What it is, how the loop trick works, how to set it up, and the fine print.