mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
重复计次修复
This commit is contained in:
@@ -253,12 +253,8 @@ class ApiKeyService {
|
|||||||
if (accountId) {
|
if (accountId) {
|
||||||
await redis.incrementAccountUsage(accountId, totalTokens, inputTokens, outputTokens, cacheCreateTokens, cacheReadTokens, model);
|
await redis.incrementAccountUsage(accountId, totalTokens, inputTokens, outputTokens, cacheCreateTokens, cacheReadTokens, model);
|
||||||
logger.database(`📊 Recorded account usage: ${accountId} - ${totalTokens} tokens (API Key: ${keyId})`);
|
logger.database(`📊 Recorded account usage: ${accountId} - ${totalTokens} tokens (API Key: ${keyId})`);
|
||||||
} else if (keyData.claudeAccountId) {
|
|
||||||
// 如果没有传入accountId,但API Key绑定了专属账户,也记录统计
|
|
||||||
await redis.incrementAccountUsage(keyData.claudeAccountId, totalTokens, inputTokens, outputTokens, cacheCreateTokens, cacheReadTokens, model);
|
|
||||||
logger.database(`📊 Recorded account usage (from API Key binding): ${keyData.claudeAccountId} - ${totalTokens} tokens (API Key: ${keyId})`);
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug(`⚠️ No accountId provided and API Key not bound to account, skipping account-level statistics`);
|
logger.debug(`⚠️ No accountId provided for usage recording, skipping account-level statistics`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user