From a3740789660f4edbb79850427017dd0aaaf172e6 Mon Sep 17 00:00:00 2001 From: dreamhunter2333 Date: Sat, 31 Jan 2026 15:08:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E6=A8=A1=E5=9E=8B=E5=90=8D=E8=AE=A1=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 计费时使用 requestBody.model(转换后的实际模型名)而不是原始请求的模型名, 这样定价表只需配置后端实际模型的价格即可。 Co-Authored-By: Claude Opus 4.5 --- src/providers/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/providers/index.ts b/src/providers/index.ts index 209c211..dd5593d 100644 --- a/src/providers/index.ts +++ b/src/providers/index.ts @@ -176,7 +176,8 @@ class ProxyEndpoint extends OpenAPIRoute { return proxyFetch(c, targetChannelConfig, requestBody, async (usage: Usage) => { try { - await TokenUtils.processUsage(c, apiKey, model, targetChannelKey, targetChannelConfig, usage); + // 使用转换后的模型名计费 + await TokenUtils.processUsage(c, apiKey, requestBody.model, targetChannelKey, targetChannelConfig, usage); } catch (error) { console.error('Error processing usage:', error); } @@ -284,7 +285,8 @@ class ResponsesProxyEndpoint extends OpenAPIRoute { return proxyFetch(c, targetChannelConfig, requestBody, async (usage: Usage) => { try { - await TokenUtils.processUsage(c, apiKey, model, targetChannelKey, targetChannelConfig, usage); + // 使用转换后的模型名计费 + await TokenUtils.processUsage(c, apiKey, requestBody.model, targetChannelKey, targetChannelConfig, usage); } catch (error) { console.error('Error processing usage:', error); }