feat: add GLM Coding (China) provider and Usage by API Keys statistics

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Blade096
2026-02-11 15:44:08 +07:00
committed by decolua
co-authored by Cursor
parent bd23ab41ee
commit 1ae4e311b7
6 changed files with 835 additions and 199 deletions
+2 -2
View File
@@ -279,7 +279,7 @@ export function estimateUsage(body, contentLength, targetFormat = FORMATS.OPENAI
/**
* Log usage with cache info (green color)
*/
export function logUsage(provider, usage, model = null, connectionId = null) {
export function logUsage(provider, usage, model = null, connectionId = null, apiKey = null) {
if (!usage || typeof usage !== "object") return;
const p = provider?.toUpperCase() || "UNKNOWN";
@@ -318,6 +318,6 @@ export function logUsage(provider, usage, model = null, connectionId = null) {
cache_creation_input_tokens: cacheCreation || 0,
reasoning_tokens: reasoning || 0
};
saveRequestUsage({ model, provider, connectionId, tokens }).catch(() => { });
saveRequestUsage({ model, provider, connectionId, tokens, apiKey: apiKey || undefined }).catch(() => { });
appendRequestLog({ model, provider, connectionId, tokens, status: "200 OK" }).catch(() => { });
}