mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-17 20:00:52 +08:00
- OAuth2 device authorization grant flow (RFC 8628) for authentication - Streaming and non-streaming chat completions via OpenAI-compatible API - Models: kimi-k2, kimi-k2-thinking, kimi-k2.5 - CLI `--kimi-login` command for device flow auth - Token management with automatic refresh - Thinking/reasoning effort support for thinking-enabled models Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
|
|
)
|
|
|
|
func init() {
|
|
registerRefreshLead("codex", func() Authenticator { return NewCodexAuthenticator() })
|
|
registerRefreshLead("claude", func() Authenticator { return NewClaudeAuthenticator() })
|
|
registerRefreshLead("qwen", func() Authenticator { return NewQwenAuthenticator() })
|
|
registerRefreshLead("iflow", func() Authenticator { return NewIFlowAuthenticator() })
|
|
registerRefreshLead("gemini", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("gemini-cli", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("antigravity", func() Authenticator { return NewAntigravityAuthenticator() })
|
|
registerRefreshLead("kimi", func() Authenticator { return NewKimiAuthenticator() })
|
|
}
|
|
|
|
func registerRefreshLead(provider string, factory func() Authenticator) {
|
|
cliproxyauth.RegisterRefreshLeadProvider(provider, func() *time.Duration {
|
|
if factory == nil {
|
|
return nil
|
|
}
|
|
auth := factory()
|
|
if auth == nil {
|
|
return nil
|
|
}
|
|
return auth.RefreshLead()
|
|
})
|
|
}
|