Hugging Face 和 OpenRouter 正在合作,让运行开放权重模型变得轻松。目前,所有主要的开放权重模型发布都已同步至 Hugging Face Hub,而 OpenRouter 则大规模托管这些模型,并根据对每个提供商的实时测量结果,将每个请求路由到 80 多个提供商中的最佳选择。通过这种方式,Hub 上由提供商提供的每一个开放权重模型都可以通过你的 Hugging Face Token,使用统一的 API 进行调用,并且系统会自动为每次请求选择最佳的提供商。
今天,我们正式将 Inference Providers(推理提供商) 从自研的路由器切换为 OpenRouter 提供的基础设施。现在发送到语言模型的请求都将经过 OpenRouter,它会根据实时的价格、速度和可靠性数据,为每次调用选择最合适的提供商;如果首选提供商失败,系统会自动重试其他提供商。你的代码无需任何更改即可继续运行。
使用你现有的工具运行它们
该路由器支持 OpenAI 的 Chat Completions 和 Responses API,以及 Anthropic 的 Messages API,适用于所有聊天模型,无论其背后的提供商是谁。选择你的编码代理或 SDK 以及一个模型,然后复制操作步骤,或者将整个设置作为提示词复制给你的代理:
Claude Code、Codex、OpenCode、Pi 和 Hermes Agent 的设置指南
同一个 Hugging Face Token 还为你提供了 Storage Buckets(存储桶) 的存储空间、Jobs(作业) 的计算能力,以及专用的 Inference Endpoints(推理端点)。PRO、Team 和 Enterprise 计划均包含每月用于计算和推理的信用的额度。
开放权重模型的使用情况
在 OpenRouter 上,开放权重模型所占的令牌比例从 2025 年 10 月的 26.8% 增长到了 2026 年 9 月底的 71.7%,并在 7 月达到过 77.5% 的峰值(OpenRouter, 2026 年 10 月)。在同一时期内,每周的开放权重模型处理量增长了超过 60 倍,而封闭权重模型的增长幅度仅为近 10 倍。本周,OpenRouter 上使用最多的模型是一款开放权重模型——DeepSeek V4.1 Flash 1017,累计处理了 59.2 万亿个令牌(排名)。

开放权重模型的平均成本大约低四倍:输入令牌每百万个 0.28 美元,输出令牌每百万个 1.62 美元,而封闭权重模型分别为 1.27 美元和 6.36 美元。
在最具挑战性的基准测试中,最好的开放权重模型仍然略逊于最好的专有模型。在 Artificial Analysis Intelligence Index(人工智能分析智能指数) 中,表现最好的开放权重模型 Kimi K3.1 Pro 得分为 46,而 Claude Fable 5.2 得分为 65,但前者的单次任务成本仅为后者的约七分之一(3.68 美元对比 26.54 美元)。对于许多工作负载来说,这种权衡是值得的。

由 OpenRouter 驱动的路由
OpenRouter 每月向超过 1000 万用户提供服务,处理超过 800 万亿个令牌,涵盖来自 80 多个提供商的 600 多种模型。其路由机制基于对该流量中每个提供商的实时测量数据。
OpenRouter 最近 重建了其提供商路由系统:不再仅仅查看最低列表价格,而是将每个请求发送给在价格、速度和可靠性方面综合表现最佳的提供商。
当某个提供商变慢或开始出现故障时,流量会从其身上移开,直到其恢复;如果某次尝试失败,系统会在同一次调用中自动重试下一个最佳提供商。根据 OpenRouter 的测量数据,新的路由策略使容量错误减少了 46%,首字生成时间缩短了 16.9%,吞吐量提高了 16.3%。

以前,Inference Providers 会为请求选择一个提供商,如果失败则返回错误。现在,请求会在另一个提供商处重试。你仍然可以通过在模型 ID 后添加后缀来选择策略或特定提供商:
zai-org/GLM-5.3:fastest # 最高吞吐量
zai-org/GLM-5.3:cheapest # 最低价格
zai-org/GLM-5.3:novita # 仅 Novita
路由系统还具备缓存感知能力:对话会保持在持有其提示词缓存的提供商上。为了明确指定这一点,请在 X-HF-Session-Id 头部中为每次对话发送一个稳定的 UUID(请参阅 提示词缓存指南)。
定价
定价没有变化:你只需在 Hugging Face 账单中支付提供商的价格,Hugging Face 不会在此基础上加收任何溢价。PRO 用户每月可获得 2 美元的信用额度,Team 和 Enterprise 组织每位成员可获得 2 美元的信用额度。详情请参阅 定价与计费。
图像、视频和音频生成
图像、视频和音频生成功能继续像以前一样正常工作,直接通过 Hugging Face Inference Providers 进行,不经过 OpenRouter。你可以继续使用相同的 Token 和 API,并访问数以万计的 LoRAs。
查看请求的去向
在模型页面上,你可以直接在组件中与模型聊天。两个新标签页展示了其背后的信息:“Providers” 列出了 OpenRouter 可以将模型路由到的所有提供商,包括其过去 24 小时的输入和输出价格、速度及正常运行时间;“Metrics” 则显示了其中表现最佳的指标,如价格、吞吐量、首字生成时间、上下文长度和正常运行时间:

你的 使用概览 会将支出按请求所去的提供商进行细分:

在你的 设置 中,你可以关闭任何你不想要的提供商:路由器永远不会将你的请求发送到那里。组织账户也拥有相同的设置,并适用于所有计入该组织的请求。

重大变更:自定义提供商密钥
现在,发送到语言模型的请求都经过 OpenRouter,并计入你的 Hugging Face 账户或组织的账单,因此你不能再为这些模型使用自己的提供商 API 密钥。你仍然可以通过在模型 ID 后添加后缀 (model:provider) 来选择提供商,或在设置中关闭提供商,且你的代码保持不变。图像和视频提供商的自定义密钥仍可正常使用。
下一步计划
这是我们与 OpenRouter 合作的第一步。接下来的计划包括:
- 将你的 OpenRouter 账户连接到 Hugging Face。
- 更多任务将通过 OpenRouter 进行路由。
尝试一个 模型,或阅读 Inference Providers 文档 以开始使用。
查看原文
Hugging Face and OpenRouter are teaming up to make open-weight models easy to run. Every major open-weight release is already being published on the Hugging Face Hub, and OpenRouter serves those models at scale, routing each request across 80+ providers based on live measurements of each one. Together, every open-weight model on the Hub that a provider serves can be called with your Hugging Face token, through the same API, with the best provider picked for each request.
Today, we are switching Inference Providers from our own custom router to OpenRouter's. Requests made to language models now go through OpenRouter, which picks the best provider for each call based on live price, speed and reliability, and retries on another provider if the first one fails. Your code stays the same.
Run them with the tools you already use
The router supports OpenAI's Chat Completions and Responses APIs and Anthropic's Messages API for every chat model, whatever the provider behind it. Pick your coding agent or SDK and a model, then copy the steps, or copy the whole setup as a prompt for your agent:
Setup guides for Claude Code, Codex, OpenCode, Pi and Hermes Agent
The same Hugging Face token also gives you storage with Storage Buckets, compute with Jobs and dedicated inference with Inference Endpoints. PRO, Team and Enterprise plans include monthly credits for compute and inference.
How open-weight models are used
On OpenRouter, open-weight models went from 26.8% of the tokens served in October 2025 to 71.7% at the end of September 2026, after peaking at 77.5% in July (OpenRouter, October 2026). Over the same period, weekly open-weight volume grew more than 60-fold, against almost tenfold for closed models. This week, the most used model on OpenRouter is an open-weight one, DeepSeek V4.1 Flash 1017, with 59.2 trillion tokens (rankings).

Open-weight models 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.
The best open-weight models still trail the best proprietary ones on the hardest benchmarks. On the Artificial Analysis Intelligence Index, Kimi K3.1 Pro, the best open-weight model, scores 46 against 65 for Claude Fable 5.2, at about a seventh of the cost per task ($3.68 against $26.54). For a lot of workloads, that trade-off is worth it.

Routing powered by OpenRouter
OpenRouter serves more than 800 trillion tokens a month to over 10 million users, across 600+ models from 80+ providers. Its routing is based on live measurements of every provider across that traffic.
OpenRouter recently rebuilt its provider routing: instead of only looking at the lowest list price, it sends each request to the provider with the best mix of price, speed and reliability.
When a provider slows down or starts failing, traffic moves away from it until it recovers, and a failed try is retried on the next best provider inside the same call. In OpenRouter's measurements, the new routing cut capacity errors by 46% and improved time to first token by 16.9% and throughput by 16.3%.

Before, Inference Providers picked one provider for your request and returned its error if it failed. Now, the request is retried on another provider. You can still choose a policy or a provider with a suffix on the model id:
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 Novita
Routing is also cache-aware: a conversation stays on the provider that holds its prompt cache. To make it explicit, send a stable UUID per conversation in the X-HF-Session-Id header (see the prompt caching guide).
Pricing
Pricing doesn't change: you pay the provider's price on your Hugging Face bill, and Hugging Face doesn't add a markup on top of it. PRO users get $2 of credits every month, and Team and Enterprise organizations get $2 per seat. See Pricing and Billing for the details.
Image, video and audio generation
Image, video, and audio generation continue to work exactly as before, directly through Hugging Face Inference Providers without going through OpenRouter. You can keep using the same token and API, and access tens of thousands of LoRAs.
See where your requests go
On model pages, you can chat with the model right away in the widget. Two new tabs show what's behind it: Providers lists every provider OpenRouter can route the model to, with its input and output price, speed and uptime over the last 24 hours, and Metrics shows the best price, throughput, time to first token, context length and uptime among them:

Your usage overview breaks your spend down by the provider each request went to:

In your settings, you can turn off any provider you don't want: the router never sends your requests there. Organizations have the same settings, and they apply to every request billed to the organization.

Breaking change: custom provider keys
Requests to language models now go through OpenRouter and are billed to your Hugging Face account or organization, so you can no longer use your own API key for a provider with these models. You can still pick a provider with a suffix on the model id (model:provider) or turn providers off in your settings, and your code stays the same. Custom keys for image and video providers keep working.
What's next
This is the first step of our partnership with OpenRouter. Next:
- Connect your OpenRouter account to Hugging Face.
- More tasks routed through OpenRouter.
Try a model, or read the Inference Providers docs to get started.
原文版权归 Hugging Face Blog 及原作者所有,本站转载仅供阅读。如需删除,请联系 support@aisa.one。