From 7726ca1f389d97a79973b24ecfdcb18b4b9460a9 Mon Sep 17 00:00:00 2001 From: hex2077 Date: Sun, 8 Mar 2026 22:11:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(openai):=20=E4=BF=AE=E5=A4=8Dfast=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=B8=8A=E6=B8=B8=E8=AF=B7=E6=B1=82=E4=B8=AD=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 确保传给上游的模型名称正确移除-fast后缀,避免因模型名称不匹配导致的API调用失败。当检测到fast模型时,会记录转换日志以便追踪。 --- VERSION | 2 +- src/providers/openai/codex-core.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 41fe9f3..4485360 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.10.9 +2.10.9.1 diff --git a/src/providers/openai/codex-core.js b/src/providers/openai/codex-core.js index 5bf42ea..7d873f3 100644 --- a/src/providers/openai/codex-core.js +++ b/src/providers/openai/codex-core.js @@ -351,9 +351,12 @@ export class CodexApiService { const cleanedBody = { ...requestBody }; delete cleanedBody.metadata; - // 如果是 fast 模型,移除后缀再传给上游 + // 【关键修复】确保传给上游的模型名称不带 -fast 后缀 + // 即使 originalRequestBody 中已经带了 model,这里也必须覆盖 + cleanedBody.model = upstreamModel; + if (isFastModel) { - cleanedBody.model = upstreamModel; + logger.info(`[Codex] Detected -fast model: ${normalizedModel} -> ${upstreamModel}, service_tier: ${cleanedBody.service_tier || defaultServiceTier}`); } // 生成会话缓存键