Hugging Face 与 OpenRouter 联手,让运行开源权重模型变得轻松易行。目前,每次主要的开源权重发布都会同步至 Hugging Face Hub,而 OpenRouter 则以规模化方式提供这些模型的服务,根据对各家供应商的实时测量数据,将每个请求路由至 80 多家供应商之一。如今,Hub 上由任何供应商提供的开源权重模型,均可通过统一的 API,使用您的 Hugging Face token 进行调用,系统会为每次请求自动选择最佳供应商。
今天,我们已将推理服务供应商从自研的自定义路由器切换至 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 倍以上,而闭源模型的增长倍数仅为近十倍。本周,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 # 默认:价格、速度和可靠性的最佳组合
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 美元的额度,团队和企业组织每个席位可获得 2 美元。详情请参阅“定价与计费”页面。
图像、视频和音频生成
图像、视频和音频生成功能继续像以前一样正常运行,直接通过 Hugging Face Inference Providers 进行,无需经过 OpenRouter。你可以继续使用相同的 token 和 API,并访问数以万计的 LoRA 模型。
查看你的请求去向
在模型页面上,你可以直接在组件中与模型对话。两个新标签页展示了其背后的机制:“Providers”列出了 OpenRouter 可以将该模型路由到的所有提供商,包括过去 24 小时内的输入和输出价格、速度及正常运行时间;“Metrics”则展示了其中最佳的价格、吞吐量、首 token 生成时间、上下文长度以及正常运行时间:
你的用量概览会将每笔请求所指向的提供商支出明细列出:
在设置中,你可以关闭任何你不希望使用的提供商:路由器绝不会将你的请求发送至这些提供商。组织账户拥有相同的设置,且该设置适用于向该组织计费的每一笔请求。
重大变更:自定义提供商密钥
对语言模型的请求现在通过 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.
首次收录 · 2026-11-17 · 9.95 分