### Build Installer Source: https://github.com/finesssee/proxypilot/blob/main/docs/desktop-app-build-process.md Run the Inno Setup compiler to generate the Windows installer. ```bash "C:\Users\FSOS\AppData\Local\Programs\Inno Setup 6\ISCC.exe" installer/proxypilot.iss ``` -------------------------------- ### Install and Import CLI Proxy SDK Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage.md Install the module via go get and import the necessary packages. ```bash go get github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy ``` ```go import ( "context" "errors" "time" "github.com/router-for-me/CLIProxyAPI/v6/internal/config" "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy" ) ``` -------------------------------- ### Install CLIProxyAPI SDK Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage_CN.md Install the CLIProxyAPI SDK using go get. Ensure to use the correct module path including /v6. ```bash go get github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy ``` -------------------------------- ### Package ProxyPilot as Installer Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Creates a Windows installer for ProxyPilot. Requires Inno Setup (ISCC.exe) to be installed. The output is saved to dist\ProxyPilot-Setup.exe. ```bash go run .\cmd\proxypilotpack package-inno ``` -------------------------------- ### Minimal CLI Proxy Service Example Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage_CN.md A minimal example demonstrating how to load configuration, create a new service builder, and run the service. The service manages configuration and token refreshing internally. Cancel the context to stop the service. ```go cfg, err := config.LoadConfig("config.yaml") if err != nil { panic(err) } svc, err := cliproxy.NewBuilder(). WithConfig(cfg). WithConfigPath("config.yaml"). // 绝对路径或工作目录相对路径 Build() if err != nil { panic(err) } ctx, cancel := context.WithCancel(context.Background()) deferr cancel() if err := svc.Run(ctx); err != nil && !errors.Is(err, context.Canceled) { panic(err) } ``` -------------------------------- ### Install ProxyPilot via Package Managers Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Installation commands for ProxyPilot using bun, npm, or Go. ```bash bun install -g proxypilot ``` ```bash npm install -g proxypilot ``` ```bash go install github.com/Finesssee/ProxyPilot/cmd/server@latest ``` -------------------------------- ### Install Go Version Info Tool Source: https://github.com/finesssee/proxypilot/blob/main/docs/desktop-app-build-process.md Install the required tool for embedding version information into Windows executables. ```bash go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest ``` -------------------------------- ### Install ProxyPilot Auto-start Source: https://github.com/finesssee/proxypilot/blob/main/scripts/macos/README.md Installs a per-user LaunchAgent for auto-starting the ProxyPilot engine at login. No admin privileges are required. The plist is saved to `~/Library/LaunchAgents/com.cliproxyapi.plist`. ```bash ./scripts/install-autostart.sh ``` -------------------------------- ### Setup Kilo or RooCode Extensions Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md These commands initiate the setup process for Kilo Code and RooCode VS Code extensions, guiding users to update their API base URL to the ProxyPilot server. ```bash proxypilot --setup-kilo ``` ```bash proxypilot --setup-roocode ``` -------------------------------- ### Start ProxyPilot Server Source: https://context7.com/finesssee/proxypilot/llms.txt Run ProxyPilot to start the local API proxy server. Specify a custom configuration file if needed. ```bash ./proxypilot # Start server on default port 8317 ./proxypilot -config /path/config # Use custom config file ``` -------------------------------- ### Install ProxyPilot Source: https://github.com/finesssee/proxypilot/blob/main/bun/proxypilot/README.md Install the package globally using bun or run it directly without installation. ```bash bun install -g proxypilot ``` ```bash bunx proxypilot ``` -------------------------------- ### Start ProxyPilot Engine Source: https://github.com/finesssee/proxypilot/blob/main/scripts/macos/README.md Use this script to start the ProxyPilot engine. Logs are available in `logs/proxypilot-engine.out.log` and `logs/proxypilot-engine.err.log`. ```bash ./scripts/start.sh ``` -------------------------------- ### API Key Configuration Example Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md Example configuration for the built-in `config-api-key` provider, listing valid API keys. ```yaml api-keys: - sk-test-123 - sk-prod-456 ``` -------------------------------- ### Initialize and Run Minimal Proxy Service Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage.md Load configuration and start the service. Cancel the context to trigger a graceful shutdown. ```go cfg, err := config.LoadConfig("config.yaml") if err != nil { panic(err) } svc, err := cliproxy.NewBuilder(). WithConfig(cfg). WithConfigPath("config.yaml"). // absolute or working-dir relative Build() if err != nil { panic(err) } ctx, cancel := context.WithCancel(context.Background()) defer cancel() if err := svc.Run(ctx); err != nil && !errors.Is(err, context.Canceled) { panic(err) } ``` -------------------------------- ### Build ProxyPilot from Source Source: https://github.com/finesssee/proxypilot/blob/main/README.md Clone the repository, navigate to the directory, build the executable using Go, and then run the server. Ensure you have Go installed. ```bash git clone https://github.com/Finesssee/ProxyPilot.git cd ProxyPilot go build -o proxypilot ./cmd/server ./proxypilot ``` -------------------------------- ### Run ProxyPilot Server Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Commands to start the proxy server with default or custom configurations. ```bash proxypilot # Start server on default port (8317) proxypilot -config /path/to/config # Use custom config file ``` -------------------------------- ### Build ProxyPilot Binaries Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Use this command to build the ProxyPilot binaries. Requires Go to be installed. ```bash go run .\cmd\proxypilotpack build ``` -------------------------------- ### Writing Custom Providers Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md A guide on how to implement and register your own custom access providers. ```APIDOC ## Writing Custom Providers ### Description Implement custom authentication logic by creating a Go struct that satisfies the provider interface and registering it. ### Provider Interface A provider must implement the following methods: - `Identifier() string`: Returns a unique identifier for the provider. - `Authenticate(ctx context.Context, r *http.Request) (*sdkaccess.Result, *sdkaccess.AuthError)`: Performs the authentication logic. ### Example Implementation ```go type customProvider struct{} func (p *customProvider) Identifier() string { return "my-provider" } func (p *customProvider) Authenticate(ctx context.Context, r *http.Request) (*sdkaccess.Result, *sdkaccess.AuthError) { token := r.Header.Get("X-Custom") if token == "" { return nil, sdkaccess.NewNotHandledError() } if token != "expected" { return nil, sdkaccess.NewInvalidCredentialError() } return &sdkaccess.Result{ Provider: p.Identifier(), Principal: "service-user", Metadata: map[string]string{"source": "x-custom"}, }, nil } func init() { sdkaccess.RegisterProvider("custom", &customProvider{}) } ``` ### Registration Call `sdkaccess.RegisterProvider` within an `init` function to make your custom provider available to the access manager. ``` -------------------------------- ### Query Available Models Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Example of how to query the available models from the ProxyPilot API. Requires an API key for authentication. ```bash curl -H "Authorization: Bearer local-dev-key" http://127.0.0.1:/v1/models ``` -------------------------------- ### Build Web UI Assets Source: https://github.com/finesssee/proxypilot/blob/main/docs/desktop-app-build-process.md Install dependencies and build the dashboard assets located in the webui directory. ```bash cd webui npm install npm run build ``` -------------------------------- ### Import the SDK Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md Import the access SDK package to use its functionalities. Add the module using `go get`. ```go import ( sdkaccess "github.com/router-for-me/CLIProxyAPI/v6/sdk/access" ) ``` -------------------------------- ### ProxyPilot Full Usage Reference Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md A comprehensive reference for all ProxyPilot CLI commands, including server control, OAuth logins, agent setup, and agent switching. ```bash proxypilot -h, --help # Show help proxypilot -v, --version # Show version # Server proxypilot # Start proxy server proxypilot -config # Use custom config file # OAuth Logins proxypilot --login # Google/Gemini login proxypilot --codex-login # Codex OAuth proxypilot --claude-login # Claude OAuth proxypilot --qwen-login # Qwen OAuth proxypilot --antigravity-login # Antigravity OAuth proxypilot --kiro-login # Kiro Google OAuth proxypilot --kiro-aws-login # Kiro AWS Builder ID # Agent Detection & Setup proxypilot --detect-agents # Detect installed agents proxypilot --setup-all # Configure all agents proxypilot --setup- # Configure specific agent # Agent Switching proxypilot --switch # Show agent status proxypilot --switch --mode proxy # Switch to proxy proxypilot --switch --mode native # Switch to native ``` -------------------------------- ### Enable Custom Installer Images Source: https://github.com/finesssee/proxypilot/blob/main/installer/assets/README.md Uncomment these lines in the proxypilot.iss file to use custom wizard images. Ensure the paths correctly point to your generated BMP files. ```ini WizardImageFile={#RepoRoot}\installer\assets\wizard-large.bmp WizardSmallImageFile={#RepoRoot}\installer\assets\wizard-small.bmp ``` -------------------------------- ### Setup AI Agent Configuration Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Commands to automatically configure detected AI agents to use the ProxyPilot proxy. ```bash proxypilot --setup-all # Configure all detected agents proxypilot --setup-claude # Configure Claude Code proxypilot --setup-codex # Configure Codex CLI proxypilot --setup-droid # Configure Factory Droid proxypilot --setup-opencode # Configure OpenCode proxypilot --setup-gemini # Configure Gemini CLI proxypilot --setup-cursor # Configure Cursor proxypilot --setup-kilo # Configure Kilo Code CLI proxypilot --setup-roocode # Configure RooCode (VS Code) ``` -------------------------------- ### Get Configuration as YAML Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve the server configuration in YAML format. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/config.yaml \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### ProxyPilot CLI Commands Source: https://github.com/finesssee/proxypilot/blob/main/bun/proxypilot/README.md Common commands for starting the server, checking agent status, and switching between proxy and native modes. ```bash # Start the ProxyPilot server proxypilot server # Show status of all agents proxypilot switch # Switch Claude to proxy mode proxypilot switch claude proxy # Switch Gemini to native mode proxypilot switch gemini native # Show help proxypilot --help ``` -------------------------------- ### Manage ProxyPilot Service Lifecycle Source: https://github.com/finesssee/proxypilot/blob/main/scripts/windows/README.md Use these scripts to build, start, stop, or restart the local proxy engine. ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build-cliproxyapi.ps1 ``` ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\start-cliproxy.ps1 ``` ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\stop-cliproxy.ps1 ``` ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\restart-cliproxy.ps1 ``` -------------------------------- ### Configure stdio MCP Server Source: https://github.com/finesssee/proxypilot/blob/main/docs/hindsight.md Example configuration for registering the Hindsight MCP server using the stdio transport method. ```json { "mcpServers": { "hindsight": { "command": "hindsight-local-mcp", "args": [], "env": { "HINDSIGHT_API_LLM_PROVIDER": "openai", "HINDSIGHT_API_LLM_API_KEY": "sk-..." } } } } ``` -------------------------------- ### Generate Wizard Images Script Source: https://github.com/finesssee/proxypilot/blob/main/installer/assets/README.md Run this PowerShell script to automatically generate the required BMP images for the installer from an existing icon. ```powershell $.\generate-wizard-images.ps1 ``` -------------------------------- ### Initialize and Configure Manager Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md Create a new manager and set its providers using the globally registered providers. Handles nil manager or no providers gracefully. ```go manager := sdkaccess.NewManager() manager.SetProviders(sdkaccess.RegisteredProviders()) ``` -------------------------------- ### Build Server and ProxyPilot Components with Go 1.26.0 Source: https://github.com/finesssee/proxypilot/blob/main/docs/session-2026-04-01.md Use this command to build the server, proxypilot-tray, and proxypilotpack components using a specific Go version managed by mise. ```shell mise exec go@1.26.0 -- go build ./cmd/server ./cmd/proxypilot-tray ./cmd/proxypilotpack ``` -------------------------------- ### GET /v0/management/memory/export Source: https://github.com/finesssee/proxypilot/blob/main/docs/memory.md Exports data for a specific session. ```APIDOC ## GET /v0/management/memory/export ### Description Exports data for a specific session. ### Method GET ### Endpoint /v0/management/memory/export ### Parameters #### Query Parameters - **session** (string) - Required - The session identifier. ``` -------------------------------- ### Initialize Context Compression Source: https://github.com/finesssee/proxypilot/blob/main/docs/long-context-features.md Initialize the summarizer with authentication manager. This is a key integration point for context compression. ```go // Context Compression - sdk/cliproxy/service.go:516 middleware.InitSummarizerWithAuthManager(wrapper, providers) ``` -------------------------------- ### GET /proxypilot.html Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Accesses the local ProxyPilot dashboard. ```APIDOC ## GET /proxypilot.html ### Description Serves the local ProxyPilot dashboard. This is a local-only endpoint and does not require manual key entry. ### Method GET ### Endpoint /proxypilot.html ``` -------------------------------- ### GET /v0/management/memory/session Source: https://github.com/finesssee/proxypilot/blob/main/docs/memory.md Retrieves details for a specific memory session. ```APIDOC ## GET /v0/management/memory/session ### Description Retrieves details for a specific memory session. ### Method GET ### Endpoint /v0/management/memory/session ### Parameters #### Query Parameters - **session** (string) - Required - The session identifier. ``` -------------------------------- ### GET /v0/management/memory/sessions Source: https://github.com/finesssee/proxypilot/blob/main/docs/memory.md Retrieves a list of all active memory sessions. ```APIDOC ## GET /v0/management/memory/sessions ### Description Retrieves a list of all active memory sessions. ### Method GET ### Endpoint /v0/management/memory/sessions ``` -------------------------------- ### Verify Build and Test Suite Source: https://github.com/finesssee/proxypilot/blob/main/docs/session-2026-04-03.md Commands to build the project, run static analysis, and execute tests using the specified Go version via mise. ```bash mise exec go@1.26.0 -- go build ./cmd/server ./cmd/proxypilot-tray ./cmd/proxypilotpack ``` ```bash mise exec go@1.26.0 -- go vet ./... ``` ```bash mise exec go@1.26.0 -- go test ./... ``` -------------------------------- ### GET /v1/models Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Retrieves a list of available AI models. ```APIDOC ## GET /v1/models ### Description Retrieves a list of available AI models. This endpoint requires an API key for authentication. ### Method GET ### Endpoint /v1/models ### Request Example curl -H "Authorization: Bearer local-dev-key" http://127.0.0.1:/v1/models ``` -------------------------------- ### GET /healthz Source: https://github.com/finesssee/proxypilot/blob/main/docs/proxypilot.md Checks the health status of the ProxyPilot service. ```APIDOC ## GET /healthz ### Description Returns the health status of the ProxyPilot service. This endpoint does not require authentication. ### Method GET ### Endpoint /healthz ``` -------------------------------- ### Get All Logs Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve all available logs. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/logs \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Register Lifecycle Hooks Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage.md Observe service startup and readiness using lifecycle hooks. ```go hooks := cliproxy.Hooks{ OnBeforeStart: func(cfg *config.Config) { log.Infof("starting on :%d", cfg.Port) }, OnAfterStart: func(s *cliproxy.Service) { log.Info("ready") }, } svc, _ := cliproxy.NewBuilder().WithConfig(cfg).WithConfigPath("config.yaml").WithHooks(hooks).Build() ``` -------------------------------- ### Run Hindsight with Python Source: https://github.com/finesssee/proxypilot/blob/main/docs/hindsight.md Installs and executes the Hindsight API directly in a Python environment. ```bash pip install hindsight-api -U export HINDSIGHT_API_LLM_PROVIDER=openai export HINDSIGHT_API_LLM_API_KEY=sk-... hindsight-api ``` -------------------------------- ### Build ProxyPilot Engine Source: https://github.com/finesssee/proxypilot/blob/main/scripts/macos/README.md Execute this script from the repo root to build the `bin/proxypilot-engine` executable. It also creates a back-compatibility copy. ```bash ./scripts/build.sh ``` -------------------------------- ### Check Agent Status Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Example output for checking the current mode of an AI agent. ```bash $ proxypilot --switch claude Claude Code: proxy Config: ~/.claude/settings.json ``` -------------------------------- ### Build Project Source: https://github.com/finesssee/proxypilot/blob/main/docs/provider-migration-iflow-to-minimax-zhipu.md Execute this command in the project root to build all packages. A successful build is indicated by '# ✓ Build successful'. ```bash go build ./... # ✓ Build successful ``` -------------------------------- ### Register Provider Executor Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-advanced.md Register the custom executor with the core manager before starting the proxy service. ```go core := coreauth.NewManager(coreauth.NewFileStore(cfg.AuthDir), nil, nil) core.RegisterExecutor(myprov.Executor{}) svc, _ := cliproxy.NewBuilder().WithConfig(cfg).WithConfigPath(cfgPath).WithCoreAuthManager(core).Build() ``` -------------------------------- ### Get Session TODO Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve the TODO list for a specific session. Requires the 'management-secret' for authorization. ```bash curl "http://localhost:8317/v0/management/memory/todo?session=session-key-123" \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Initialize cliproxy Service with Access Manager Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md Configures a new cliproxy service instance by injecting a pre-existing access manager. ```go coreCfg, _ := config.LoadConfig("config.yaml") accessManager := sdkaccess.NewManager() svc, _ := cliproxy.NewBuilder(). WithConfig(coreCfg). WithConfigPath("config.yaml"). WithRequestAccessManager(accessManager). Build() ``` -------------------------------- ### Get Current Server Configuration Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve the current server configuration. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/config \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Initialize Minimal Embedded ProxyPilot Server Source: https://context7.com/finesssee/proxypilot/llms.txt Basic implementation for running the proxy service within a Go application using a configuration file. ```go package main import ( "context" "errors" "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy" "github.com/router-for-me/CLIProxyAPI/v6/sdk/config" ) func main() { cfg, err := config.LoadConfig("config.yaml") if err != nil { panic(err) } svc, err := cliproxy.NewBuilder(). WithConfig(cfg). WithConfigPath("config.yaml"). Build() if err != nil { panic(err) } ctx, cancel := context.WithCancel(context.Background()) defer cancel() if err := svc.Run(ctx); err != nil && !errors.Is(err, context.Canceled) { panic(err) } } ``` -------------------------------- ### Get Prompt Cache Statistics Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve statistics about the prompt cache. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/prompt-cache/stats \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Agent Configuration Source: https://context7.com/finesssee/proxypilot/llms.txt Configure installed CLI agents to work with ProxyPilot. This simplifies integration with your development tools. ```bash ./proxypilot --detect-agents # Detect installed CLI agents ./proxypilot --setup-all # Configure all detected agents ./proxypilot --setup-claude # Configure Claude Code ./proxypilot --setup-codex # Configure Codex CLI ``` -------------------------------- ### Configure Server Middleware and Routes Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage.md Use WithServerOptions to inject custom middleware, engine configurations, and API routes. ```go svc, _ := cliproxy.NewBuilder(). WithConfig(cfg). WithConfigPath("config.yaml"). WithServerOptions( // Add global middleware cliproxy.WithMiddleware(func(c *gin.Context) { c.Header("X-Embed", "1"); c.Next() }), // Tweak gin engine early (CORS, trusted proxies, etc.) cliproxy.WithEngineConfigurator(func(e *gin.Engine) { e.ForwardedByClientIP = true }), // Add your own routes after defaults cliproxy.WithRouterConfigurator(func(e *gin.Engine, _ *handlers.BaseAPIHandler, _ *config.Config) { e.GET("/healthz", func(c *gin.Context) { c.String(200, "ok") }) }), // Override request log writer/dir cliproxy.WithRequestLoggerFactory(func(cfg *config.Config, cfgPath string) logging.RequestLogger { return logging.NewFileRequestLogger(true, "logs", filepath.Dir(cfgPath)) }), ). Build() ``` -------------------------------- ### Get Session Events Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve events, such as dropped messages, for a specific session. Requires the 'management-secret' for authorization. ```bash curl "http://localhost:8317/v0/management/memory/events?session=session-key-123" \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Initialize ProxyPilot and Droid CLI Configuration Source: https://github.com/finesssee/proxypilot/blob/main/scripts/windows/README.md Run this script once from the repository root to build the engine and update the Droid configuration file. ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup-droid-cliproxy.ps1 -ProxyApiKey "" ``` -------------------------------- ### Get Request Log Status Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve the current status of request logging. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/request-log \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Importing the SDK Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md How to import the access SDK package into your Go project. ```APIDOC ## Importing the SDK ### Description Import the `sdk/access` package to utilize its functionalities for request authentication. ### Code Example ```go import ( sdkaccess "github.com/router-for-me/CLIProxyAPI/v6/sdk/access" ) ``` ### Installation Add the module with `go get github.com/router-for-me/CLIProxyAPI/v6/sdk/access`. ``` -------------------------------- ### Detect Installed AI Agents Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Command to scan the system for supported AI CLI tools and their configuration status. ```bash proxypilot --detect-agents ``` -------------------------------- ### Import Credentials Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Commands to import service account keys or existing IDE tokens. ```bash proxypilot --vertex-import # Import Vertex service account key JSON proxypilot --kiro-import # Import Kiro token from Kiro IDE ``` -------------------------------- ### Build Executables Source: https://github.com/finesssee/proxypilot/blob/main/docs/desktop-app-build-process.md Compile the CLI and tray application for Windows. ```bash # Build CLI executable GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/proxypilot.exe ./cmd/server # Build tray app (with -H windowsgui to hide console) GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -H windowsgui" -o dist/ProxyPilot.exe ./cmd/proxypilot-tray ``` -------------------------------- ### Run API Key Login for Providers Source: https://github.com/finesssee/proxypilot/blob/main/README.md Initiate login for providers that require an API key. The system will prompt you to enter the key. ```bash ./proxypilot --minimax-login # MiniMax API key ``` ```bash ./proxypilot --zhipu-login # Zhipu AI API key ``` -------------------------------- ### Get Session Details Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve detailed information about a specific session using its key. Requires the 'management-secret' for authorization. ```bash curl "http://localhost:8317/v0/management/memory/session?session=session-key-123" \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Get Top Cached Prompts Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve a list of the most frequently used prompts in the cache. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/prompt-cache/top \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Download Go Dependencies Source: https://github.com/finesssee/proxypilot/blob/main/CONTRIBUTING.md After cloning the repository, download all necessary Go module dependencies using the go mod download command. ```bash go mod download ``` -------------------------------- ### Clone ProxyPilot Repository Source: https://github.com/finesssee/proxypilot/blob/main/CONTRIBUTING.md Clone the ProxyPilot repository to your local machine and navigate into the project directory. This is the first step for setting up your development environment. ```bash git clone https://github.com/your-org/ProxyPilot.git cd ProxyPilot ``` -------------------------------- ### List available models Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve a list of all models configured across all providers. ```bash curl http://localhost:8317/v1/models \ -H "Authorization: Bearer your-api-key" ``` -------------------------------- ### List All Auth Files Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve a list of all configured authentication files. Requires the 'management-secret' for authorization. ```bash curl http://localhost:8317/v0/management/auth-files \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Get Models for Auth File Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve the models associated with a specific authentication file ID. Requires the 'management-secret' for authorization. ```bash curl "http://localhost:8317/v0/management/auth-files/models?id=claude-oauth-1" \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Loading Providers from External Go Modules Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-access.md Instructions on how to import and use providers from external Go modules. ```APIDOC ## Loading Providers from External Go Modules ### Description To use providers from other Go modules, import them using a blank identifier to ensure their registration side effect runs. ### Example ```go import ( _ "github.com/acme/xplatform/sdk/access/providers/partner" // registers partner-token sdkaccess "github.com/router-for-me/CLIProxyAPI/v6/sdk/access" ) ``` ### Explanation The blank identifier import (`_`) ensures that the `init` function within the imported package executes, which typically calls `sdkaccess.RegisterProvider`. This makes the provider available before `RegisteredProviders()` is called or before the CLI proxy is built. ``` -------------------------------- ### Get Specific Request Log by ID Source: https://context7.com/finesssee/proxypilot/llms.txt Retrieve a specific request log using its unique ID. Requires the 'management-secret' for authorization. ```bash curl "http://localhost:8317/v0/management/request-log-by-id/req-abc123" \ -H "Authorization: Bearer management-secret" ``` -------------------------------- ### Implement Custom Access Provider in Go Source: https://context7.com/finesssee/proxypilot/llms.txt Define custom authentication logic by implementing the access provider interface and registering it via init(). ```go package main import ( "context" "net/http" sdkaccess "github.com/router-for-me/CLIProxyAPI/v6/sdk/access" ) type CustomAccessProvider struct{} func (p *CustomAccessProvider) Identifier() string { return "custom-auth" } func (p *CustomAccessProvider) Authenticate(ctx context.Context, r *http.Request) (*sdkaccess.Result, *sdkaccess.AuthError) { token := r.Header.Get("X-Custom-Token") if token == "" { return nil, sdkaccess.NewNotHandledError() } // Validate token against your auth system if !validateToken(token) { return nil, sdkaccess.NewInvalidCredentialError() } return &sdkaccess.Result{ Provider: p.Identifier(), Principal: extractUserID(token), Metadata: map[string]string{"source": "x-custom-token"}, }, nil } func init() { sdkaccess.RegisterProvider("custom", &CustomAccessProvider{}) } func validateToken(token string) bool { return token == "valid-token" } func extractUserID(token string) string { return "user-123" } ``` -------------------------------- ### Import CLIProxyAPI SDK Packages Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-usage_CN.md Import necessary packages from the CLIProxyAPI SDK. Note the module path includes /v6. ```go import ( "context" "errors" "time" "github.com/router-for-me/CLIProxyAPI/v6/internal/config" "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy" ) ``` -------------------------------- ### ProxyPilot Backup Structure Source: https://github.com/finesssee/proxypilot/blob/main/docs/cli.md Illustrates the directory structure and naming convention for backups created by ProxyPilot before modifying agent configurations. ```bash ~/.claude/.proxypilot-backups/ settings.json.20251228-221853.bak ~/.codex/.proxypilot-backups/ config.toml.20251228-221853.bak ``` -------------------------------- ### Set Auth Update Queue Source: https://github.com/finesssee/proxypilot/blob/main/docs/sdk-watcher.md Wires the SDK service's auth update queue into the watcher. The queue must be created before the watcher starts. ```go WatcherWrapper.SetAuthUpdateQueue(chan<- watcher.AuthUpdate) ```