Tools

AI-generated text

Hugging Face switches language model routing to OpenRouter

Hugging Face has replaced its custom language model router with OpenRouter's system, which selects providers using live price, speed and reliability data.

Hugging Face switches language model routing to OpenRouter

Hugging Face and OpenRouter have replaced the custom router used by Hugging Face Inference Providers for language model requests with OpenRouter's system. It selects a provider for each request using live price, speed and reliability data, and retries with another provider within the same call if the first attempt fails. Existing code does not need to change.

Open-weight models published on the Hugging Face Hub can be accessed through the same API and Hugging Face token when a provider serves them. OpenRouter routes requests among more than 80 providers using continuously collected measurements.

Compatibility and routing

For every chat model, the router supports OpenAI's Chat Completions and Responses APIs and Anthropic's Messages API, regardless of the provider running the model. Setup guides are available for Claude Code, Codex, OpenCode, Pi and Hermes Agent. The same Hugging Face token also provides access to Storage Buckets for storage, Jobs for compute and Inference Endpoints for dedicated inference.

OpenRouter says it serves more than 800 trillion tokens a month to over 10 million users, across more than 600 models and 80 providers. Its recently rebuilt router no longer considers only the lowest list price: when a provider slows down or begins to fail, the system shifts traffic away until it recovers. In OpenRouter's measurements, the new approach reduced capacity errors by 46%, improved time to first token by 16.9% and improved throughput by 16.3%.

Previously, Inference Providers selected one provider and returned its error if the request failed. Alongside automatic retries, users can still select a routing policy or a specific provider through a model ID suffix: for example, :fastest selects the highest throughput, :cheapest the lowest price and :novita only the Novita provider.

Routing also takes caching into account, keeping a conversation with the provider that holds its prompt cache. To make this explicit, users can send a stable UUID for each conversation in the X-HF-Session-Id header.

Open-weight model usage

According to OpenRouter's October 2026 data, open-weight models' share of tokens served rose from 26.8% in October 2025 to 71.7% at the end of September 2026, after peaking at 77.5% in July. Over the same period, their weekly volume grew more than 60-fold, while that of closed models increased almost tenfold. The source says the most-used model on OpenRouter that week was the open-weight DeepSeek V4.1 Flash 1017, with 59.2 trillion tokens.

Open-weight models cost about four times less on average: $0.28 per million input tokens and $1.62 per million output tokens, compared with $1.27 and $6.36 respectively for closed models.

The best open-weight models still trail leading proprietary models on the hardest benchmarks. On the Artificial Analysis Intelligence Index, Kimi K3.1 Pro, identified as the best open-weight model, scored 46 against 65 for Claude Fable 5.2. The cost per task was $3.68 for the former and $26.54 for the latter, making the open model about one-seventh as expensive per task.

Pricing, controls and exceptions

Pricing is unchanged: users pay the provider's price on their Hugging Face bill, with no markup from Hugging Face. PRO users receive $2 in credits each month, while Team and Enterprise organizations receive $2 per seat. These plans include monthly credits for compute and inference.

Image, video and audio generation continue directly through Hugging Face Inference Providers rather than OpenRouter. The same token and API remain usable, with access to tens of thousands of LoRAs.

A new Providers tab on model pages lists available providers, their input and output prices, and their speed and uptime over the previous 24 hours. A Metrics tab shows measures including the best price, throughput, time to first token, context length and uptime. The usage overview breaks down spending by provider.

Users can disable providers in their settings, after which the router will not send requests to them. Organization settings apply to every request billed to that organization.

The switch introduces one compatibility change: users can no longer use their own provider API keys for language model requests, because those requests pass through OpenRouter and are billed to the Hugging Face account or organization. Users can still select a provider with a model ID suffix or disable it in settings. Custom keys for image and video providers continue to work.

As the next steps in the partnership, the companies plan to enable OpenRouter account connections to Hugging Face and route more types of tasks through OpenRouter.