Documentation
¶
Overview ¶
Package cmd provides command-line interface functionality for the CLI Proxy API. It implements the main application commands including login/authentication and server startup, handling the complete user onboarding and service lifecycle.
Package cmd provides command-line interface functionality for the CLI Proxy API.
Package cmd provides command-line interface functionality for the CLI Proxy API. It implements the main application commands including login/authentication and server startup, handling the complete user onboarding and service lifecycle.
Package cmd provides command-line interface functionality for the CLI Proxy API. It implements the main application commands including login/authentication and server startup, handling the complete user onboarding and service lifecycle.
Package cmd provides command-line interface functionality for the CLI Proxy API. It implements the main application commands including login/authentication and server startup, handling the complete user onboarding and service lifecycle.
Package cmd provides command-line interface functionality for the CLI Proxy API. It implements the main application commands including service startup, authentication client management, and graceful shutdown handling. The package handles loading authentication tokens, creating client pools, starting the API server, and monitoring configuration changes through file watchers.
Index ¶
- func DoClaudeLogin(cfg *config.Config, options *LoginOptions)
- func DoCodexLogin(cfg *config.Config, options *LoginOptions)
- func DoGeminiWebAuth(cfg *config.Config)
- func DoLogin(cfg *config.Config, projectID string, options *LoginOptions)
- func DoQwenLogin(cfg *config.Config, options *LoginOptions)
- func StartService(cfg *config.Config, configPath string)
- type LoginOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoClaudeLogin ¶
func DoClaudeLogin(cfg *config.Config, options *LoginOptions)
DoClaudeLogin handles the Claude OAuth login process for Anthropic Claude services. It initializes the OAuth flow, opens the user's browser for authentication, waits for the callback, exchanges the authorization code for tokens, and saves the authentication information to a file.
Parameters:
- cfg: The application configuration
- options: The login options containing browser preferences
func DoCodexLogin ¶
func DoCodexLogin(cfg *config.Config, options *LoginOptions)
DoCodexLogin handles the Codex OAuth login process for OpenAI Codex services. It initializes the OAuth flow, opens the user's browser for authentication, waits for the callback, exchanges the authorization code for tokens, and saves the authentication information to a file.
Parameters:
- cfg: The application configuration
- options: The login options containing browser preferences
func DoGeminiWebAuth ¶ added in v5.2.0
DoGeminiWebAuth handles the process of creating a Gemini Web token file. It prompts the user for their cookie values and saves them to a JSON file.
func DoLogin ¶
func DoLogin(cfg *config.Config, projectID string, options *LoginOptions)
DoLogin handles the entire user login and setup process for Google Gemini services. It authenticates the user, sets up the user's project, checks API enablement, and saves the token for future use.
Parameters:
- cfg: The application configuration
- projectID: The Google Cloud Project ID to use (optional)
- options: The login options containing browser preferences
func DoQwenLogin ¶
func DoQwenLogin(cfg *config.Config, options *LoginOptions)
DoQwenLogin handles the Qwen OAuth login process for Alibaba Qwen services. It initializes the OAuth flow, opens the user's browser for authentication, waits for the callback, exchanges the authorization code for tokens, and saves the authentication information to a file.
Parameters:
- cfg: The application configuration
- options: The login options containing browser preferences
func StartService ¶
StartService initializes and starts the main API proxy service. It loads all available authentication tokens, creates a pool of clients, starts the API server, and handles graceful shutdown signals. The function performs the following operations: 1. Walks through the authentication directory to load all JSON token files 2. Creates authenticated clients based on token types (gemini, codex, claude, qwen) 3. Initializes clients with API keys if provided in configuration 4. Starts the API server with the client pool 5. Sets up file watching for configuration and authentication directory changes 6. Implements background token refresh for Codex, Claude, and Qwen clients 7. Handles graceful shutdown on SIGINT or SIGTERM signals
Parameters:
- cfg: The application configuration containing settings like port, auth directory, API keys
- configPath: The path to the configuration file for watching changes
Types ¶
type LoginOptions ¶
type LoginOptions struct {
// NoBrowser indicates whether to skip opening the browser automatically.
NoBrowser bool
}
LoginOptions contains options for the Codex login process.