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
+4 -3
View File
@@ -83,19 +83,19 @@ export async function handleChat(request, clientRawRequest = null) {
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleModelChat(b, m, clientRawRequest, request),
handleSingleModel: (b, m) => handleSingleModelChat(b, m, clientRawRequest, request, apiKey),
log
});
}
// Single model request
return handleSingleModelChat(body, modelStr, clientRawRequest, request);
return handleSingleModelChat(body, modelStr, clientRawRequest, request, apiKey);
}
/**
* Handle single model chat request
*/
async function handleSingleModelChat(body, modelStr, clientRawRequest = null, request = null) {
async function handleSingleModelChat(body, modelStr, clientRawRequest = null, request = null, apiKey = null) {
const modelInfo = await getModelInfo(modelStr);
if (!modelInfo.provider) {
log.warn("CHAT", "Invalid model format", { model: modelStr });
@@ -153,6 +153,7 @@ async function handleSingleModelChat(body, modelStr, clientRawRequest = null, re
clientRawRequest,
connectionId: credentials.connectionId,
userAgent,
apiKey,
onCredentialsRefreshed: async (newCreds) => {
await updateProviderCredentials(credentials.connectionId, {
accessToken: newCreds.accessToken,