Skip to content

Commit f5f932d

Browse files
committed
fix(gateway): gpt-5.6-luna 过滤不支持的 top_p 参数,发布 1.2.66
- gpt-5.6-luna 不支持 top_p 采样参数,通用客户端默认携带 top_p=1 导致上游 400 - 模型目录新增 NoTopP 标记,转发时移除 - 无数据库迁移
1 parent 5893e78 commit f5f932d

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

backend/cmd/server/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.65
1+
1.2.66

backend/internal/service/openai_gateway_chat_completions.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ func (s *OpenAIGatewayService) ForwardAsChatCompletions(
180180
return nil, fmt.Errorf("convert chat completions to responses: %w", err)
181181
}
182182
responsesReq.Model = upstreamModel
183+
if opencodeResolved != nil && opencodeResolved.Spec.NoTopP {
184+
// 上游模型不支持 top_p(如 gpt-5.6-luna),通用 OpenAI 兼容客户端
185+
// 常默认携带 top_p=1,移除避免上游报 "Unsupported parameter: 'top_p'"。
186+
responsesReq.TopP = nil
187+
}
183188
normalizeResponsesRequestServiceTier(responsesReq)
184189
responsesBody, err = json.Marshal(responsesReq)
185190
if err != nil {

backend/internal/service/opencode_go_model_catalog.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ type OpencodeGoModelSpec struct {
1616
ID string
1717
Protocol OpencodeGoProtocol
1818
Deprecated bool
19+
// NoTopP 标记上游模型不支持 top_p 采样参数(如 gpt-5.6-luna)。
20+
// 通用 OpenAI 兼容客户端常默认携带 top_p=1,网关需在转发时移除,
21+
// 否则上游报 "Unsupported parameter: 'top_p'"。
22+
NoTopP bool
1923
}
2024

2125
// opencodeGoModelCatalog 是 2026-09-07 审核的 OpenCode Go 模型快照:
@@ -55,7 +59,7 @@ var opencodeGoModelCatalog = [...]OpencodeGoModelSpec{
5559
{ID: "hy4-preview", Protocol: OpencodeGoProtocolChat},
5660
{ID: "hy3", Protocol: OpencodeGoProtocolChat},
5761
{ID: "hy3-preview", Protocol: OpencodeGoProtocolChat},
58-
{ID: "gpt-5.6-luna", Protocol: OpencodeGoProtocolResponses},
62+
{ID: "gpt-5.6-luna", Protocol: OpencodeGoProtocolResponses, NoTopP: true},
5963
{ID: "grok-4.5", Protocol: OpencodeGoProtocolResponses, Deprecated: true},
6064
{ID: "grok-4.6", Protocol: OpencodeGoProtocolResponses},
6165
{ID: "muse-spark-1.2-contributor", Protocol: OpencodeGoProtocolResponses},

docs/site/content/docs/operations/changelog.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ title: 更新日志
33
description: 按版本记录 Pixel API 的主要功能更新。
44
---
55

6+
## v1.2.66
7+
8+
- 修复 gpt-5.6-luna 报 `Unsupported parameter: 'top_p'` 的问题:该模型不支持 top_p 采样参数,网关现在在转发时自动移除该参数。
9+
- 数据库无新增迁移。
10+
611
## v1.2.65
712

813
- 修复 OpenCode 分组对通用客户端(Cherry Studio 等)仍报 `missing x-opencode-session` 的问题:网关现在在客户端未携带该头时自动生成会话标识,而不仅是透传。

0 commit comments

Comments
 (0)