fix: 使用转换后的模型名计费
计费时使用 requestBody.model(转换后的实际模型名)而不是原始请求的模型名, 这样定价表只需配置后端实际模型的价格即可。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c75dade7df
commit
a374078966
1 file changed
+4
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user