News 4 min read

Hugging Face moves Inference Providers to OpenRouter's router


Hugging Face and OpenRouter announced a partnership on November 16: Hugging Face’s Inference Providers service has switched from its own custom router to OpenRouter’s, so every request to a language model now goes through OpenRouter, which picks a provider for each call and retries on another one if the first fails. For developers it means one Hugging Face token can call any open-weight model on the Hub that a provider serves, through OpenAI- and Anthropic-compatible APIs, without changing existing code. It also brings one breaking change: you can no longer bring your own API key for a language model provider.

What’s new

According to the Hugging Face announcement:

  • New router. Language model requests to Inference Providers are routed by OpenRouter across its 80+ providers. The router chooses based on live price, speed and reliability, and a failed attempt is retried on the next best provider inside the same call. Before, Inference Providers picked one provider and returned its error if it failed.
  • Same APIs. The router supports OpenAI’s Chat Completions and Responses APIs and Anthropic’s Messages API for every chat model, whatever provider sits behind it. Hugging Face has setup guides for Claude Code, Codex, OpenCode, Pi and Hermes Agent.
  • Routing suffixes. You can still steer each request with a suffix on the model id: no suffix for the default mix, :fastest for the highest throughput, :cheapest for the lowest price, or a provider name such as :novita to use only that provider.
  • Cache-aware routing. A conversation stays on the provider holding its prompt cache. You can make that explicit by sending a stable UUID per conversation in the X-HF-Session-Id header.
  • Visibility. Model pages get two new tabs: Providers lists each provider OpenRouter can route the model to with its price, speed and uptime over the last 24 hours, and Metrics shows the best values among them. The usage overview now breaks spend down by provider, and you (or an organization) can turn off any provider the router should never use.
  • Pricing unchanged. You pay the provider’s price on your Hugging Face bill with no Hugging Face markup. PRO users get $2 of credits a month, and Team and Enterprise organizations get $2 per seat.
  • Image, video and audio generation keeps working exactly as before, directly through Inference Providers and not through OpenRouter.

OpenRouter says it serves more than 800 trillion tokens a month to over 10 million users, across 600+ models. Hugging Face cites OpenRouter’s measurements that its rebuilt provider routing cut capacity errors by 46% and improved time to first token by 16.9% and throughput by 16.3%.

What it means for developers

If you already call https://router.huggingface.co/v1 with an OpenAI-compatible client, nothing in your code changes; the requests simply start going through OpenRouter’s routing and gain automatic failover. The Inference Providers docs show the setup with the OpenAI JavaScript SDK:

import { OpenAI } from "openai";

const client = new OpenAI({
  baseURL: "https://router.huggingface.co/v1",
  apiKey: process.env.HF_TOKEN,
});

const completion = await client.chat.completions.create({
  model: "deepseek-ai/DeepSeek-V4.1-Flash:fastest",
  messages: [{ role: "user", content: "How many 'G's in 'huggingface'?" }],
});

Drop the :fastest suffix to let the router balance price, speed and reliability, or pin a single provider by name when you need predictable behaviour, for example to reproduce a bug. Because retries now happen inside one call, it is worth checking your own retry logic so you don’t stack client retries on top of the router’s.

The breaking change matters if you used Inference Providers with your own key for a provider: language model requests are now billed to your Hugging Face account or organization, so custom provider keys no longer work for those models. Provider suffixes and the provider settings still let you control where requests go, and custom keys for image and video providers keep working. Since the router speaks the OpenAI and Anthropic APIs, SDKs that wrap several model services, like the Vercel AI SDK, can point their OpenAI-compatible client at the same base URL.

Hugging Face calls this the first step of the partnership. Next on its list: connecting an OpenRouter account to Hugging Face, and routing more tasks through OpenRouter.

How it compares

The announcement makes the case for open-weight models with OpenRouter’s numbers. 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. They cost about four times less on average: $0.28 per million input tokens and $1.62 per million output tokens, against $1.27 and $6.36 for closed models.

Hugging Face is open about the gap at the top. On 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 ($3.68 against $26.54). For workloads that don’t need the strongest model, that trade is what the new routing is meant to make easy.

Sources