Custom LLM query JSON body field currently not supported? #4707
|
I need to use openrouter models and also pin the providers, here's a example from https://openrouter.ai/docs/guides/routing/provider-selection I need an additional provider field in json body. pi-ai does support it: OpenRouterRouting rides the model's compat.openRouterRouting, and the wire body gets params.provider = model.compat.openRouterRouting (openai-completions.js lines 643–644). dsh gates compat keys: the config schema lists exactly the declared switches (config.ts lines 245–266, no passthrough), and assertOfferedCompatFields refuses anything else — "sets compat X, which no wire protocol declares" (catalog.ts lines 497–531). openRouterRouting is not in the offered set (a compile-time assertion keeps the set == PiAiCompatProfile fields). No request-level channel exists either: the adapter forwards only reasoning/temperature/maxTokens/sessionId to pi-ai. I would suggest
|
Replies: 3 comments
|
你的分析是准确的,而且我可以从一个完全独立的角度印证它——我们(做 DSH 上的兼容层,同样要把 Pi 侧的 compat 声明翻译成 DSH profile 字段)在自己的文档里写下了同一条边界,用词几乎一样:
也就是说: (你提到的那个"compile-time assertion keeps the set == PiAiCompatProfile fields",我们这边也有对应物:我们那张映射表钉着 你的两个建议里,第 2 个明显更该推建议 1(settings.yaml 支持自定义字段透传)我建议放弃,理由不是保守,是这个门本来就是为了挡一类真实事故:
建议 2(把 #780 提的正是同一个形状——把 pi-ai 已有的两个开关( 所以你的建议 2 不是在开先河,是在走一条已经走通过的路。 强烈建议在原帖里引 #780 作为模板——它连"为什么是配置而不是扩展自动探测"那段论证都现成(原话大意:自动探测只能枚举一方端点,第三方网关的方言封不住)。 今天能用的绕法:本地透传器注入那个字段在等提案落地期间,你可以在 DSH 和 OpenRouter 之间放一个本地转发器,转发前往 JSON body 里塞上 我们仓库里有个可以直接拿来改的透传器( 性质要说清:这是绕过不是修复,而且多一跳本地转发。但它有个额外好处——你能直接看到 DSH 到底发了什么,这在调 provider 路由时很省事。 (另外一个更轻的可能:OpenRouter 的模型 id 支持一些后缀形式的路由控制,如果你的需求刚好能用 id 表达,那连代理都不用。这条我没试过,你查一下它的文档比我猜准。) 一个更大的背景,值得写进提案你这条是我最近见到的**第四个"端点需要/拒绝某个字段,而 DSH 没有配置面去表达"**的例子:
四条合起来的意思不是"再加一个字段",而是:gate 的设计(协议感知 + fail loud)是对的,但"哪些字段被提供"这份名单的增长速度跟不上真实端点的多样性。 把这层写出来,比单独申请一个字段更有可能推动一个可持续的答案(比如:厂商目录路由能否让用户覆盖其中的 vendor-owned 字段)。 边界与利益相关我们不修 DSH 自家组件—— 利益相关:我维护 pi2dsh(Pi 生态兼容层)。这条不推销——你要的是 DSH 的 compat 名单加一个字段,装我们的东西对此毫无帮助;第三节那个脚本是独立单文件,拷走就能跑。 |
|
There is a lighter current workaround than a local body-rewriting proxy when the routing policy is stable: OpenRouter Presets can store the A safe deployment shape is:
The dedicated route matters because a DSH This does not remove the upstream gap. The source-level fix should remain typed: flip I documented the rc.2 source chain, Preset route, verification evidence, gateway alternative, and fifteen acceptance gates here: https://github.com/sandbaseai/deepseek-harness-handbook/blob/main/docs/en/integrations/openrouter-provider-pinning.md Affiliation: I maintain this SandBase handbook. It is an independent community project, not official DeepSeek AI or OpenRouter documentation. |
|
Your reading of the mechanism is right, but the field is not undeclared — it is deliberately classified, and I think it is classified wrongly. That distinction matters, because it changes the fix from "add a passthrough" to "reclassify one field", which is far smaller and does not weaken the gate. It is
|
There is a lighter current workaround than a local body-rewriting proxy when the routing policy is stable: OpenRouter Presets can store the
providerobject and be referenced through the existing model field as@preset/<slug>. That path does not require DSH to accept arbitrary JSON.A safe deployment shape is:
providerpolicy;@preset/...id from a dedicated DSH pi-ai route;The dedicated route matters because a DSH
modelslist replaces tha…