AIsaAIsaStudio English 打开 AIsa Studio

Hugging Face 与 OpenRouter 合作,语言模型推理切换为 OpenRouter 路由

原标题:Hugging Face and OpenRouter join forces to make open-weight models easy to run

Hugging Face 与 OpenRouter 合作,将 Inference Providers 的语言模型请求切换为 OpenRouter 路由,按实时价格、速度和可靠性为每次调用选择最佳供应商,失败时自动在另一家供应商重试。新路由在 OpenRouter 的测量中把容量错误减少 46%,首 token 时间改善 16.9%,吞吐提升 16.3%;请求计入 Hugging Face 账单且不加价,语言模型不能再使用自定义供应商 API key。

为什么值得看

官方公告讲清了路由切换后的计费、可用 API 和破坏性变更,开发者可直接据此调整现有调用方式。

阅读原文 ↗11月17日 AI 日报

本页的摘要、推荐理由与解读出自 AIsa Studio 的 AI 风向智能体,原文版权归原作者所有。

深度解读

发生了什么

Hugging Face 与 OpenRouter 达成合作,将语言模型的推理服务从 Hugging Face 自研路由切换为 OpenRouter 的路由。Hub 上所有有服务商支持的开放权重模型,现在都可以用 Hugging Face token 通过同一套 API 调用。

关键细节

  • OpenRouter 会根据实时的价格、速度和可靠性为每次请求选择最合适的服务商,首次调用失败时会在另一家服务商上重试。此前 Inference Providers 只选定一家服务商,失败就直接返回错误。
  • 路由支持 OpenAI 的 Chat Completions 和 Responses API 以及 Anthropic 的 Messages API;用户可以通过模型 id 后缀(如 :fastest、:cheapest 或指定服务商)选择策略或服务商,路由还具备缓存感知,会话会留在持有其 prompt 缓存的服务商上。
  • OpenRouter 重建的路由机制在其测量中将容量错误减少了 46%,首 token 时间提升 16.9%,吞吐量提升 16.3%。
  • 定价不变:用户按服务商价格付费,Hugging Face 不加价;PRO 用户每月获得 2 美元额度,Team 和 Enterprise 按席位每月 2 美元。
  • 图像、视频和音频生成仍直接通过 Hugging Face Inference Providers,不经过 OpenRouter,图像和视频服务商的自定义密钥继续可用。
  • 破坏性变更:语言模型请求将计入 Hugging Face 账户或组织,这些模型不再支持使用用户自己的服务商 API 密钥。模型页新增 Providers 和 Metrics 两个标签页,设置中可按用户或组织关闭不想使用的服务商。

为什么重要

OpenRouter 上开放权重模型的使用量从 2025 年 10 月占所服务 token 的 26.8% 增长到 2026 年 9 月底的 71.7%(7 月一度达到 77.5%),同期开放权重的周调用量增长超过 60 倍,而闭源模型接近 10 倍。本周 OpenRouter 上使用量最高的模型是开放权重的 DeepSeek V4.1 Flash 1017,达 59.2 万亿 token。

开放权重模型的平均成本约为闭源模型的四分之一(每百万输入 token 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 美元)。对很多工作负载来说这种权衡是值得的,而路由的简化降低了大规模运行开放权重模型的门槛。

对谁有影响

使用 Hugging Face Inference Providers 调用语言模型的开发者:代码无需改动,但这些模型不再支持自定义服务商密钥,请求将计入 Hugging Face 账户计费。组织可获得统一的服务商设置,后续计划包括关联 OpenRouter 账户以及让更多任务经由 OpenRouter 路由。

全文翻译

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 万亿个令牌(排名)。

OpenRouter 上开放权重模型占令牌的比例,从 2025 年 10 月的 26.8% 上升至 2026 年 9 月的 71.7% OpenRouter 上开放权重模型占令牌的比例,从 2025 年 10 月的 26.8% 上升至 2026 年 9 月的 71.7%

开放权重模型的平均成本大约低四倍:输入令牌每百万个 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%。

默认路由在首个提供商受速率限制时会重试另一个提供商,:cheapest 选择最低价格,:fastest 选择最高吞吐量 默认路由在首个提供商受速率限制时会重试另一个提供商,:cheapest 选择最低价格,:fastest 选择最高吞吐量

以前,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” 则显示了其中表现最佳的指标,如价格、吞吐量、首字生成时间、上下文长度和正常运行时间:

在模型页面组件中与 Inkling-2-Small 聊天,打开其代码片段,然后查看其 Metrics 标签页 在模型页面组件中与 Inkling-2-Small 聊天,打开其代码片段,然后查看其 Metrics 标签页

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

每日 Inference Providers 支出,按提供商细分 每日 Inference Providers 支出,按提供商细分

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

Inference Providers 设置,每个提供商都有一个开关 Inference Providers 设置,每个提供商都有一个开关

重大变更:自定义提供商密钥

现在,发送到语言模型的请求都经过 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' share of tokens on OpenRouter, from 26.8% in October 2025 to 71.7% in September 2026 Open-weight models' share of tokens on OpenRouter, from 26.8% in October 2025 to 71.7% in September 2026

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.

Artificial Analysis Intelligence Index against cost per task, for the top proprietary and open-weight models Artificial Analysis Intelligence Index against cost per task, for the top proprietary and open-weight models

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%.

Default routing retries on another provider when the first one is rate limited, :cheapest picks the lowest price and :fastest the highest throughput Default routing retries on another provider when the first one is rate limited, :cheapest picks the lowest price and :fastest the highest throughput

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:

Chatting with Inkling-2-Small in the model page widget, opening its code snippets, then its Metrics tab Chatting with Inkling-2-Small in the model page widget, opening its code snippets, then its Metrics tab

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

Daily Inference Providers spend, broken down by provider Daily Inference Providers spend, broken down by provider

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.

Inference Providers settings, with a toggle for each provider Inference Providers settings, with a toggle for each provider

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。

事件综述

Hugging Face 语言模型推理路由切换至 OpenRouter

2026年11月16日,Hugging Face 与 OpenRouter 宣布合作:其 Inference Providers 服务的语言模型请求改经 OpenRouter 路由,由 OpenRouter 按实时价格、速度和可靠性为每次调用选择最佳供应商,失败时自动切换到另一家供应商重试。用户仍可使用 Hugging Face token,且请求计入 Hugging Face 账单、不加价;新增 ':fastest'、':cheapest' 等后缀可固定路由策略或指定供应商。据 OpenRouter 的测量,新路由使容量错误减少 46%,首 token 时间改善 16.9%,吞吐提升 16.3%。同日 Hugging Face 介绍这是合作的第一部分,还包括用户可在 OpenRouter 直接访问开源模型权重,以及将 OpenRouter 的 agent 轨迹存储到 Hugging Face 上以便检查、训练或分享。限制方面:语言模型请求不再支持自定义供应商 API key;而图像、视频(及音频)生成仍走原有路径,不受此次切换影响。后续报道称开源模型占 OpenRouter 最常用模型 token 用量的 70% 以上。

其他来源的报道 2