mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 04:20:50 +08:00
- Implemented OAuth login flow for the Antigravity provider in `auth/antigravity.go`. - Added `AntigravityExecutor` for handling requests and streaming via Antigravity APIs. - Created `antigravity_login.go` command for triggering Antigravity authentication. - Introduced OpenAI-to-Antigravity translation logic in `translator/antigravity/openai/chat-completions`. **refactor(translator, executor): update Gemini CLI response translation and add Antigravity payload customization** - Renamed Gemini CLI translation methods to align with response handling (`ConvertGeminiCliResponseToGemini` and `ConvertGeminiCliResponseToGeminiNonStream`). - Updated `init.go` to reflect these method changes. - Introduced `geminiToAntigravity` function to embed metadata (`model`, `userAgent`, `project`, etc.) into Antigravity payloads. - Added random project, request, and session ID generators for enhanced tracking. - Streamlined `buildRequest` to use `geminiToAntigravity` transformation before request execution.
31 lines
1.0 KiB
Go
31 lines
1.0 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() })
|
|
}
|
|
|
|
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()
|
|
})
|
|
}
|