读见

Hugging Face 与 OpenRouter 携手合作,让开放权重模型更易运行

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

约 4 分钟约 922 字原文英文已翻译

推荐理由Hugging Face 将开放权重模型推理路由接入 OpenRouter,并公开容量错误和首 token 延迟的变化。开发者可了解动态服务商选择、失败重试及手动路由控制如何影响模型接入可靠性。

读前速览

4 个要点

Hugging Face 与 OpenRouter 合作,通过智能服务商选择系统转发语言模型请求,根据价格、速度和可靠性进行优化,同时保持相同的 API 和基于令牌的身份验证方式。

  1. OpenRouter 通过 80+ 家服务商处理所有语言模型请求的路由

    系统会根据实时测得的价格、速度和可靠性自动路由请求,并在失败时自动重试,使容量错误减少 46%,吞吐量提升 16.3%。

  2. 开放权重模型在 OpenRouter 流量中占主导地位,并显著降低成本

    从 2025 年 10 月到 2026 年 9 月,开放权重模型占所提供令牌的比例从 26.8% 增至 71.7%,成本约为闭源模型的四分之一(每百万令牌 $0.28-$1.62,而闭源模型为 $1.27-$6.36)。

  3. 用户继续使用相同的 API 和令牌身份验证方式,同时获得更灵活的路由控制

    同一个 Hugging Face 令牌即可用于 OpenRouter 路由。用户可以通过模型 ID 后缀(:fastest、:cheapest、:novita)指定路由策略,也可以在设置中停用服务商。

  4. 图像、视频和音频生成不受 OpenRouter 集成影响

    这些模态仍可直接通过 Hugging Face Inference Providers 使用,无需经过 OpenRouter,从而保留现有工作流和自定义服务商密钥。

完整摘要

Hugging Face 已将语言模型推理请求的路由切换至 OpenRouter。OpenRouter 会根据实时测得的价格、速度和可靠性,从 80+ 个选项中动态选择最佳服务商。此项变更支持在服务商故障时自动重试,使容量错误减少 46%,首个令牌生成时间缩短 16.9%。开放权重模型目前占所提供令牌的 71.7%,使用量增长了 60 倍,成本约为闭源模型的四分之一。用户仍可通过模型 ID 后缀(:fastest、:cheapest、:novita)控制路由,也可在设置中停用特定服务商。此次集成沿用相同的 Hugging Face 令牌身份验证方式,并扩大了对 Claude Code、Codex 和 OpenCode 等工具的支持。

目录 · 8 节

查看原文
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.

今天,我们将推理服务提供商从自建路由器切换为 OpenRouter。现在,发往语言模型的请求都会经由 OpenRouter 处理,由它根据实时价格、速度和可靠性为每次调用选择最佳提供商;如果第一个提供商失败,它还会重试其他提供商。你的代码无需更改。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

该路由器支持所有聊天模型使用 OpenAI 的 Chat Completions 和 Responses API,以及 Anthropic 的 Messages API,无论其背后的提供商是谁。选择你的编码代理或 SDK 和模型,然后复制这些步骤,或者将整套配置复制为提示词交给你的代理: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:

Claude Code、Codex、OpenCode、Pi 和 Hermes Agent 的设置指南Setup guides for Claude Code, Codex, OpenCode, Pi and Hermes Agent

同一个 Hugging Face 令牌还可让你使用 Storage Buckets 存储、通过 Jobs 使用计算资源,以及使用 Inference Endpoints 专属推理服务。PRO、Team 和 Enterprise 计划包含每月计算和推理额度。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

在 OpenRouter 上,开放权重模型所处理的 token 占比从 2025 年 10 月的 26.8% 升至 2026 年 9 月底的 71.7%,并于 7 月达到 77.5% 的峰值(OpenRouter,2026 年 10 月)。同期,开放权重模型的周调用量增长了 60 多倍,而闭源模型的周调用量增长了近 10 倍。本周,OpenRouter 上使用量最高的模型是一款开放权重模型:DeepSeek V4.1 Flash 1017,处理了 59.2 万亿个 token(排名)。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

开放权重模型的平均成本约为封闭模型的四分之一:每百万输入 token 0.28 美元,每百万输出 token 1.62 美元;封闭模型的相应价格分别为 1.27 美元和 6.36 美元。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.

最好的开放权重模型在最难的基准测试中仍落后于最好的专有模型。在 Artificial Analysis Intelligence Index 上,表现最好的开放权重模型 Kimi K3.1 Pro 得分为 46,而 Claude Fable 5.2 得分为 65;不过,前者每项任务的成本约为后者的七分之一(3.68 美元对 26.54 美元)。对于许多工作负载来说,这种取舍是值得的。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

由 OpenRouter 提供支持的路由功能 Routing powered by OpenRouter

OpenRouter 每月为超过 1000 万用户提供超过 800 万亿个 token,涵盖来自 80 多家提供商的 600 多种模型。其路由基于对各家提供商在这些流量中的实时测量数据。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 最近重构了其提供商路由机制:它不再只关注最低标价,而是会将每个请求发送给在价格、速度和可靠性方面综合表现最佳的提供商。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.

当某个提供商响应变慢或开始故障时,流量会从该提供商转移,直到其恢复;失败的尝试会在同一次调用中转由下一个最佳提供商重试。根据 OpenRouter 的测量数据,这种新的路由方式将容量错误减少了 46%,将首个 token 的生成时间缩短了 16.9%,并将吞吐量提高了 16.3%。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

此前,Inference Providers 会为你的请求选择一个提供商,如果失败则返回其错误。现在,请求会在另一个提供商上重试。你仍然可以通过在模型 ID 后添加后缀来选择策略或提供商: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

路由也会考虑缓存:对话会保持在持有其提示缓存的提供商上。为明确指定这一点,请在 X-HF-Session-Id 标头中为每段对话发送一个稳定的 UUID(请参阅提示缓存指南)。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

定价不会改变:你在 Hugging Face 账单上支付的是服务提供商的价格,Hugging Face 不会在此基础上加价。PRO 用户每月可获得 2 美元额度,Team 和 Enterprise 组织的每个席位可获得 2 美元额度。详情请参阅“定价与账单”。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

图像、视频和音频生成仍与之前完全相同,可直接通过 Hugging Face Inference Providers 使用,无需经过 OpenRouter。你可以继续使用相同的令牌和 API,并访问数以万计的 LoRA。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

在模型页面上,你可以直接在小组件中与模型聊天。新增的两个标签页展示了其背后的信息:Providers 列出了 OpenRouter 可将请求路由到的所有模型提供商,以及它们的输入和输出价格、过去 24 小时的速度和正常运行时间;Metrics 则显示其中的最低价格、吞吐量、首个令牌响应时间、上下文长度和正常运行时间: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

您的用量概览会按每次请求所调用的提供商细分支出:Your usage overview breaks your spend down by the provider each request went to:

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

重大变更:自定义提供商密钥 Breaking change: custom provider keys

现在,发往语言模型的请求会通过 OpenRouter 发送,并计入你的 Hugging Face 账户或组织的费用,因此你无法再为使用这些模型的提供商配置自己的 API 密钥。你仍可选择模型 ID 带有后缀(model:provider)的提供商,或在设置中关闭提供商;代码则保持不变。图像和视频提供商的自定义密钥仍可正常使用。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

这是我们与 OpenRouter 合作的第一步。接下来:This is the first step of our partnership with OpenRouter. Next:

  • 将你的 OpenRouter 账户连接到 Hugging Face。
    Connect your OpenRouter account to Hugging Face.
  • 更多任务通过 OpenRouter 路由。
    More tasks routed through OpenRouter.

试用一个模型,或阅读 Inference Providers 文档以开始使用。Try a model, or read the Inference Providers docs to get started.

值得记下

  1. Hugging Face 与 OpenRouter 携手合作,让开放权重模型更易运行。
  2. 开放权重模型的平均成本约低至四分之一:每百万输入令牌 $0.28,每百万输出令牌 $1.62;相比之下,闭源模型分别为 $1.27 和 $6.36。
  3. 新的路由机制使容量错误减少 46%,首个令牌生成时间缩短 16.9%,吞吐量提升 16.3%。
  4. 现在,发往语言模型的请求都会经过 OpenRouter。它会根据实时价格、速度和可靠性,为每次调用选择最佳服务商;如果首选服务商发生故障,还会改由其他服务商重试。你的代码无需改动。

← 回到本期 · 第 12 条