llm-pi-ai: a mixed-protocol catalog route cannot serve a model the installed catalog has not shipped #7076
Replies: 1 comment
|
Update (after checking pi's pi's Unreleased changelog carries two relevant entries: OpenCode / OpenCode Go now send That would remove this report's trigger, not its subject. The next model a provider publishes — or the next id whose spelling differs from the bundled catalog — hits the same wall, and the error's suggested remedy is still the destructive one. Both suggestions above are about that path, not about this one model. |
Uh oh!
There was an error while loading. Please reload this page.
What happens
Configuring an installed-catalog route with a model id the bundled catalog does not carry is rejected:
Concrete case:
opencode-go+deepseek-v4.1-flash. The model exists upstream (https://opencode.ai/zen/go/v1/modelslists it), but@earendil-works/pi-ai@0.85.1's bundleddist/providers/data/opencode-go.jsonships onlydeepseek-v4-flash,deepseek-v4-flash-vision-exp,deepseek-v4-pro.Why
Resolution has three sources of a wire protocol, and all three are empty here (
packages/llm/llm-pi-ai/src/catalog.ts):request.api— not configured;base?.api— the catalog has no entry with this id;routeApi—sharedCatalogApi()(:659) returns the protocol only when the route's shipped models agree, andopencode-gospans three (anthropic-messages,openai-completions,openai-responses), so it returnsundefined.The part I think is a real gap
Following the error's advice (
set the route's api) is not side-effect-free on a mixed route:modelsreplaces the route's catalog wholesale (:868);modelOverridesrefuses ids the catalog does not describe (:853);modelsentry has noapifield (src/config.ts:299);request.apioutranks each entry'sbase?.api(:888), and setting it also switches the route off the catalog provider onto the protocol table (src/provider.ts:172).So on a mixed-protocol catalog route there is no configuration that serves the new model and keeps the sibling models on their own protocols. The only working shape is a second route:
This also contradicts the intent recorded at
catalog.ts:653("add a model the installed catalog has not caught up with ... without restating the protocol its siblings already use"), which holds only for single-protocol routes.opencodeis affected the same way, so this is not specific to one provider.Suggested fixes
apion amodelsentry (entry.api ?? request.api ?? base?.api ?? routeApi). Most-specific-wins matches howcompatalready layers per model over the route. Purely additive.routeApiis undefined because the route is mixed, say so and point at the second-route workaround instead ofset the route's api, which narrows every sibling model.Not urgent for me — a second route works — but the current error leads users to the destructive option first.
中文版
配置内置目录路由时,若模型 id 不在打包的目录里,会被拒绝:
具体场景:
opencode-go+deepseek-v4.1-flash。该模型上游确实存在(https://opencode.ai/zen/go/v1/models里有),但@earendil-works/pi-ai@0.85.1打包的dist/providers/data/opencode-go.json只有deepseek-v4-flash、deepseek-v4-flash-vision-exp、deepseek-v4-pro。原因。 协议只有三个来源(
packages/llm/llm-pi-ai/src/catalog.ts:888),此处三者全空:路由未配api;目录无同 id 条目;sharedCatalogApi()(:659)仅在该路由所有内置模型协议一致时才返回协议,而opencode-go横跨三种协议,故返回undefined。我认为真正的缺口。 按报错提示去设置路由
api在混合协议路由上有副作用:models会整体替换目录(:868);modelOverrides拒绝目录未收录的 id(:853);models条目没有api字段(src/config.ts:299);而request.api优先级高于每个条目的base?.api(:888),设置后该路由还会从 catalog provider 切到协议表重建(src/provider.ts:172)。因此在混合协议路由上,不存在既能服务新模型、又能保住兄弟模型原生协议的配置,只能另开一条路由(示例见上)。这与
catalog.ts:653注释宣称的意图相矛盾——那句话只在单协议路由上成立。opencode同样受影响。建议修法。 ①允许
models条目声明api(最具体者优先,与compat的按模型覆盖语义一致,纯增量);②改进报错文案:当routeApi因混合协议而为undefined时明说,并指向「另开路由」这一无副作用方案。对我而言不紧急(另开路由可用),但现有报错会先把人引向有副作用的那条路。
Environment.
@deepseek-ai/dsh0.1.5-rc.2,@earendil-works/pi-ai0.85.1 (npmlatest), macOS; code references fromddefc45(2026-09-17). Verified upstream:GET https://opencode.ai/zen/go/v1/modelslistsdeepseek-v4.1-flash.All reactions