Add Qwen support

This commit is contained in:
Luis Pater
2025-08-21 05:11:21 +08:00
parent d58cc55cb2
commit aa2f37d54d
20 changed files with 2888 additions and 9 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/luispater/CLIProxyAPI/internal/auth/claude"
"github.com/luispater/CLIProxyAPI/internal/auth/codex"
"github.com/luispater/CLIProxyAPI/internal/auth/gemini"
"github.com/luispater/CLIProxyAPI/internal/auth/qwen"
"github.com/luispater/CLIProxyAPI/internal/client"
"github.com/luispater/CLIProxyAPI/internal/config"
"github.com/luispater/CLIProxyAPI/internal/util"
@@ -281,6 +282,20 @@ func (w *Watcher) reloadClients() {
} else {
log.Errorf(" failed to decode token file %s: %v", path, err)
}
} else if tokenType == "qwen" {
var ts qwen.QwenTokenStorage
if err = json.Unmarshal(data, &ts); err == nil {
// For each valid token, create an authenticated client
log.Debugf(" initializing qwen authentication for token from %s...", filepath.Base(path))
qwenClient := client.NewQwenClient(cfg, &ts)
log.Debugf(" authentication successful for token from %s", filepath.Base(path))
// Add the new client to the pool
newClients = append(newClients, qwenClient)
successfulAuthCount++
} else {
log.Errorf(" failed to decode token file %s: %v", path, err)
}
}
}
return nil