无需更新即可在 OpenClaw 中使用新模型
原题Use new models in OpenClaw without an update
推荐理由OpenClaw 用托管目录、账户模型列表和本地 Codex 版本发现模型,提供动态能力发现与版本一致性的具体实现,可供工具平台维护者借鉴。
读前速览
OpenClaw 重新设计了模型发现系统,从托管目录、账户专属模型列表和本地 Codex 版本这 3 个来源动态获取模型列表,无需发布新版本即可使用新模型,同时修复超时和版本不匹配等可靠性问题。
动态发现模型,免去等待新版本发布的时间
OpenClaw 现在从托管目录、提供商的账户专属模型列表和本地 Codex 版本获取模型列表,用户无需等待新版本发布,就能立即使用新模型。
通过 3 个来源解析模型,避免版本与可用性脱节
系统整合公开目录数据、用户账户可访问的模型以及本地 Codex 二进制文件,确保模型既显示在列表中,也能实际运行;同时修复了因版本不匹配导致模型虽出现在选择器中、运行时却失败的问题。
通过可靠性改进妥善处理超时和部分故障
目录现在会通过指数退避机制重试失败的提供商请求,在切换目录期间保留最近一次有效的模型列表,并将单个提供商故障视为警告,而不是致命错误。
精选推荐模型,让模型选择器在模型数量庞大时仍易于使用
可用模型超过 1,000 个后,目录会为每个提供商提供人工精选的推荐列表;选择器会将这些推荐模型显示在完整列表之前,从而减轻认知负担,加快模型发现速度。
完整摘要
OpenClaw 重建了模型发现流程,解决用户必须等待新版本发布才能使用刚推出模型的问题。此前,每个提供商插件都内置了静态模型清单,更新清单需要完整更新 OpenClaw。新系统从 3 个来源获取模型数据:每 4 小时从 models.dev 汇总数据并自动更新的托管目录 catalog.openclaw.ai;OpenAI 和 Anthropic 等提供商的账户专属模型列表,其中显示的模型可能仅对特定用户开放;以及本地安装的 Codex 二进制文件版本。这样一来,用户无需更新即可立即使用 GPT-6.1 Sol 等新模型。文章还介绍了针对可靠性问题的修复,包括目录刷新失败、提供商超时,以及 Codex 版本不匹配漏洞——模型列表与实际运行的二进制文件版本不一致。此外,文章还介绍了模型选择器的性能优化,包括加快加载速度,以及提供精心筛选的推荐模型列表,以应对超过 1,000 个模型的规模。
目录 · 14 节
OpenAI 发布 GPT-6.1 Sol 时,使用 ChatGPT 登录的 OpenClaw 用户无法选择它。OpenClaw 内置的是 Codex 0.158.0,而 ChatGPT 只向 Codex 0.159.2 及更新版本提供 Sol;要更改这个版本号,唯一的办法就是由我们发布一个新版本。When OpenAI shipped GPT-6.1 Sol, people who use OpenClaw with a ChatGPT sign-in could not select it. OpenClaw bundled Codex 0.158.0 but ChatGPT only offers Sol to Codex 0.159.2 and newer, and the only way to change that number was for us to ship a release.
发布当天是人们最想试用模型的时候,而我们却让他们不得不等待。因此,在大约五周时间里,通过约 80 个拉取请求,我们重建了 OpenClaw 探测现有模型的机制。Launch day is when people most want to try a model, and we were the reason they had to wait. So over about five weeks and roughly 80 pull requests, we rebuilt how OpenClaw finds out which models exist.
这篇文章介绍了 OpenClaw 现在从哪三个地方获取模型列表、我们曾发布后又回滚的一项修复,以及仍有哪些内容需要发布。This post covers the three places OpenClaw now gets its model list from, one fix we shipped and then reverted, and what still needs a release.
模型过去如何触达用户How a model used to reach users
每个提供商插件都在清单文件中包含其模型列表,而该文件随 OpenClaw 软件包一同发布。提供商以插件形式发布,插件与某个版本绑定。Each provider plugin carried its model list in a manifest file, and that file shipped inside the OpenClaw package. Providers ship as plugins and plugins are bound to a release.
OpenClaw 现在会从三个来源加载你的模型列表。OpenClaw now hydrates your model list from three places.
1. 一个自动更新的目录1. A catalog that updates itself
我们在 catalog.openclaw.ai 托管了一个模型目录。系统每四小时重建一次目录,从 models.dev 获取模型数据,叠加我们自己的清单,添加价格,然后发布结果。目前目录中约有 1,000 个模型。We host a model catalog at catalog.openclaw.ai. A job rebuilds it every four hours. It takes model data from models.dev, lays our own manifests on top, adds prices, and publishes the result. It holds about 1,000 models today.
运行中的 Gateway 会在后台检查是否有更新的目录,并实时切换到该目录。A running Gateway checks for a newer catalog in the background and switches to it live.
- 之前:Gateway 会下载新目录,但在重启之前会继续使用旧目录。Before: the Gateway downloads a new catalog and keeps using the old one until you restart it.
- 此后:新的轮次使用新目录。已经开始的轮次会继续使用启动时所用的目录,因此模型列表及其价格始终保持一致。After: new turns use the new catalog. A turn already in progress finishes on the catalog it started with, so its model list and its prices always match.
发布方还会移除已停用或服务提供商不再提供的模型。The publisher also removes models that have been retired or are no longer served by the provider.
例如,NVIDIA 停止在其 API 上提供两个模型,但目录中仍列出了它们。E.g. NVIDIA stopped serving 2 models on their API but the catalog still listed them.
它是如何损坏的How it broke
9 月 21 日,models.dev 将 kimi-for-coding 条目拆分为两个新条目。我们的发布器将缺少一个提供商视为致命错误,因此每次运行都失败了。GPT-6 Sol 和 Luna 在此期间未能推送到现有安装实例。现在,缺少提供商时只会记录一条警告,只有该提供商不会获得最新数据。On September 21, models.dev split its kimi-for-coding entry into two new ones. Our publisher treated one missing provider as a fatal error, so every run failed. GPT-6 Sol and Luna did not reach existing installs in that time. A missing provider now logs a warning, and only that provider goes without fresh data.
2. 如果你的账户中列出了它,就可以选择它。2. If your account lists it, you can pick it
目录记录了公开可用的内容。你的账户则决定了你能使用什么。登录某个提供商后,OpenClaw 会向它请求模型列表,并显示其中所有聊天模型,包括比你当前安装版本更新的模型,以及只有你的账户才能访问的模型。The catalog knows what exists in public. Your account knows what you can use. When you sign in to a provider, OpenClaw asks it for your model list and shows every chat model on it, including models newer than your install or models only your account can access.
- OpenAI API 密钥。之前:未知模型:openai/gpt-5.2,尽管账户中列出了该模型。之后:账户中列出的聊天模型会显示并运行。OpenAI API key. Before:
Unknown model: openai/gpt-5.2, although the account lists it. After: chat models your account lists appear and run. - Anthropic API 密钥。之前:新的 Claude 模型会一直隐藏,直到 OpenClaw 发布新版本。之后:Anthropic 的模型列表一旦返回该模型,它就会显示出来。Anthropic API key. Before: a new Claude model stays hidden until an OpenClaw release. After: it appears as soon as Anthropic’s model list returns it.
- Claude Code。之前:我们维护的固定列表。之后:Claude Code 为你的账户提供的模型菜单。Claude Code. Before: a fixed list that we maintained. After: the model menu Claude Code reports for your account.
- GitHub Copilot。之前:kimi-k3 在首次调用时因 unsupported_api_for_model 失败。之后:我们读取每个模型支持的端点,并使用相应端点。GitHub Copilot. Before:
kimi-k3fails its first turn withunsupported_api_for_model. After: we read which endpoint each model accepts and use that one. - Grok 订阅。之前:grok-4.7-build-fast 提供两种思考级别:off 和 ultra。之后:正如其列表所示,它提供 low、medium、high 和 xhigh。Grok subscription. Before:
grok-4.7-build-fastoffers two thinking levels, off and ultra. After: it offers low, medium, high and xhigh, as its listing says. - Ollama。之前:运行 ollama pull 后,模型始终不显示。之后:下次刷新时它就会显示。Ollama. Before: you run
ollama pulland the model never shows up. After: it shows up on the next refresh. - OpenCode Go。之前:你的账户支持的四个模型都未显示。之后:列出的所有模型都会显示。OpenCode Go. Before: four models your account serves are missing. After: every listed model appears.
这项工作有一半是围绕模型能力展开的。OpenClaw 过去会根据模型名称猜测其思考级别和请求格式,但遇到从未见过的新模型时就会失效。提供商已经在模型列表中公布了这些信息,因此我们改为直接从列表中读取。Half of this work was about what a model can do. OpenClaw used to guess thinking levels and request format from the model’s name, which fails on any new model it has never seen. Providers already publish this in their listings, so we read it from there instead.
3. Codex 版本问题3. The Codex version problem
这就是帖子开头提到的 Sol bug。ChatGPT 会根据客户端报告的 Codex 版本来决定提供哪些模型。旧版本可选的模型列表会更短。This is the Sol bug from the top of the post. ChatGPT decides which models to offer from the Codex version the client reports. An old version gets a shorter list.
首次尝试:报告最新的 Codex 版本First try: report the newest Codex version
我们的第一个修复很简单:让 npm 查询最新的 Codex 版本,并在获取列表时报告该版本号。Sol 出现在选择器中。Our first fix was simple. Ask npm for the latest Codex version and report that number when we fetch the list. Sol appeared in the picker.
我们从中吸取教训的一个错误A mistake we learned from
遗憾的是,列表请求中指定了 0.161.0,但对话仍然运行在捆绑的 0.160.0 上,而且该二进制文件会在每次请求中报告自己的版本。任何需要更新版本的模型都会出现在选择器中,但随后会因 HTTP 400 而失败。我们只是把故障从选择器转移到了第一条消息上,情况反而更糟。我们撤销了这项改动。Unfortunately, the list request said 0.161.0, but turns still ran on the bundled 0.160.0, and that binary reports its own version with every request. A model that needed anything newer would appear in the picker and then fail with HTTP 400. We had moved the failure from the picker to the first message, which is worse. We reverted it.
目前已发布的内容What ships now
OpenClaw 会在 PATH 中查找 Codex。如果它是稳定版、比随附版本更新且主版本号相同,OpenClaw 就会与它进行实际握手。如果握手成功,同一个二进制文件会获取模型列表并运行你的对话轮次。如果任何步骤失败,OpenClaw 就会使用随附的 Codex。它绝不会替你安装任何东西。OpenClaw looks for a Codex on your PATH. If it is a stable release, newer than the bundled one and on the same major version, OpenClaw does a real handshake with it. If that passes, the same binary fetches the model list and runs your turns. If anything fails, OpenClaw uses the bundled Codex. It never installs anything for you.
这是在安装了 Codex 0.162.1 的 Mac 上运行测试时生成的 Gateway 日志行:This is the Gateway log line from a test run on a Mac with Codex 0.162.1 installed:
[agent/embedded] Codex app-server: using installed ~/.local/bin/codex 0.162.1 (newer than bundled 0.161.0)
现在,只需更新你的全局 Codex,就能获取需要它的模型。Updating your global Codex is now enough to get a model that needs it.
不再缩短的列表A list that stops shrinking
找到模型是一个问题。让它们留在屏幕上则是另一个问题。过去,列表会因为与用户毫无关系的原因而丢失模型。Finding models was one problem. Keeping them on screen was another. The list used to lose models for reasons that had nothing to do with the user.
OpenRouter 超时一次OpenRouter times out once
- 之前:466 → 3 个模型。它们会一直消失,直到有人手动刷新。Before: 466 → 3 models. They stay gone until someone runs a manual refresh.
- 之后:它会自行重试。第一次在 30 秒后,之后的间隔会逐渐延长,最长可达 30 分钟。After: it retries on its own. First after 30 seconds, then with longer gaps up to 30 minutes.
网关切换到新目录The Gateway switches to a new catalog
- 之前:在生产环境的 Gateway 上,模型数量从 599 个降至 54 个,耗时最长可达四分钟。Before: 599 → 54 models, for up to four minutes on a production Gateway.
- 之后:始终为 599。旧列表会一直保留,直到新列表完成。After: 599 the whole time. The old list stays until the new one is complete.
你更改了默认模型You change the default model
- 之前:68–142 秒。网关在重新加载每个大型插件时卡住了。Before: 68–142 seconds. The Gateway froze while it reloaded every large plugin.
- 之后:0.6–1.4 秒。它会重复使用已加载的插件。After: 0.6–1.4 seconds. It reuses the plugins it already has loaded.
选择器现在也会立即打开。它们会显示 OpenClaw 已知的模型,并在后台补充其余模型。以前,它们最多会等待五秒,直到发现过程完成。Pickers also open at once now. They show the models OpenClaw already knows and fill in the rest in the background. They used to wait up to five seconds for discovery to finish.
一千个模型太多了。A thousand models is too many
一旦显示所有模型,列表就会变得很长。仅 OpenRouter 就有 466 个。因此,目录现在为每个服务商提供一份精简的推荐列表,选择器会优先显示这些模型。Once every model shows up, the list gets long. OpenRouter alone has 466. So the catalog now carries a short recommended list for each provider, and pickers put it first.
这是我们自己的某个网关上的同一个选择器。在 OpenAI 分组中,当前模型排在最前面,接着是两个推荐模型,然后其余 33 个都收在一行后面。This is the same picker on one of our own Gateways. In the OpenAI group, the current model comes first, then the two recommended models, then the other 33 behind one row.
推荐列表由我们根据自身经验和多项基准测试手动整理,并每日更新。The recommended list is manually curated and updated daily from our own experience + a variety of benchmarks.
关键要点Key takeaways
- 列出某个模型的版本也必须实际运行该模型。报告一个 Codex 版本,却运行另一个版本,只是把故障从模型选择器推迟到了第一条消息。The version that lists a model must also run it. Reporting one Codex version and running another only moved the failure from the picker to the first message.
- 从列表中读取模型能力,而不是从名称推断。提供商列表已经说明模型支持哪些思考级别和端点。基于模型名称的规则,一遇到我们从未见过的模型就会失效。Read capabilities from the listing, not the name. Provider listings already say which thinking levels and endpoints a model supports. Rules based on the model name break on the first model we have never seen.
- 保留最后一份正常的列表。刷新失败或切换目录后,选择器中的模型数量都不应少于之前。Keep the last good list. A failed refresh or a catalog switch should never leave the picker with fewer models than before.
- 一个有问题的数据源不应阻碍其他数据源。models.dev 上某个 provider 更名后,所有 provider 的目录更新都停止了,直到我们将其改为警告。One broken source should not block the rest. A renamed provider on models.dev stopped catalog updates for every provider until we made it a warning.
还有什么需要发布What still needs a release
- 如果你没有安装更新版本的 Codex,随附的版本仍会决定你能看到哪些 ChatGPT 模型。If you have no newer Codex installed, the bundled version still decides which ChatGPT models you see.
- 比目录更新的模型暂时还没有价格。OpenClaw 会将其费用显示为未知,并在目录更新之前采用谨慎的默认限制运行。A model newer than the catalog has no price yet. OpenClaw shows its cost as unknown, and it runs with cautious default limits until the catalog catches up.
要查看当前安装可访问的内容,请运行 openclaw models list --refresh。To see what your install can reach right now, run openclaw models list --refresh.
接下来是什么What’s next
我们会持续改进使用体验,并支持更多提供商。如果你的账户中列出了某个模型,但 OpenClaw 没有显示,请提交一个 issue,并附上该命令的输出。We will keep improving the experience over time and support more providers. If your account lists a model that OpenClaw does not show, open an issue and include the output of that command.
致谢Acknowledgements
作者:Ayaan Zaidi。感谢 @vincentkoc 贡献 catalog v2 和按路由定价,感谢 @ly85206559 提供 models.dev 供应商别名,感谢 @mcooks-cmd 修复目录工作器的内存问题,以及感谢 @steipete 加快多供应商目录刷新。Written by Ayaan Zaidi. Thanks to @vincentkoc for catalog v2 and per-route pricing, @ly85206559 for the models.dev provider aliases, @mcooks-cmd for the catalog worker memory fix, and @steipete for faster multi-provider catalog refreshes.
主要拉取请求:从 models.dev 获取模型目录、采用实时目录、列出账户模型、选择已安装的 Codex、重试发现流程,以及在选择器中显示推荐模型。Main pull requests: catalog from models.dev, live catalog adoption, account model listing, installed Codex selection, discovery retry, recommended models in pickers.