fix(opencode): address review on dispatch, billing, session, and 402

Skip OpenAI messages-dispatch gpt-5.x defaults for OpenCode groups and
composite OpenCode targets. Filter unpriced claude-* billing candidates,
estimate count_tokens locally, sanitize body session IDs before setting
X-OpenCode-Session, and treat Zen 402 as recoverable payg cooldown.

Stop rewriting the inbound body before protocol routing so account
model_mapping applies once and usage_logs.model stays the client name.
This commit is contained in:
刘佳林 committed 2026-09-11 15:39:13 +08:00
1 parent 981279c996
commit efcc2252e5
13 files changed
+47 -60

No files matched your search

@@ -79,10 +79,10 @@ func (g *Group) ResolveMessagesDispatchModel(requestedModel string) string {
return xai.ModelMappingWithOptions(opts)["claude-*"]
}
// 国产供应商分组:调度级模型映射不适用(其配置被 sanitize 置空,且下方的
// gpt-5.x 默认值是 openai 专属,发给 CN 上游必错)。模型改写完全交给账号级
// model_mapping;anthropic 协议上游本身接受 claude-* 模型名。
if IsCNProvider(g.Platform) {
// 国产供应商 / OpenCode 分组:调度级模型映射不适用(其配置被 sanitize 置空,
// 且下方的 gpt-5.x 默认值是 openai 专属,发给这些上游必错)。模型改写完全
// 交给账号级 model_mapping;Anthropic 协议上游本身接受 claude-* 模型名。
if IsMultiProtocolAPIKeyProvider(g.Platform) {
return ""
}