ProxyPal Documentation

repository·main·Indexed 22 days ago

https://github.com/heyhuynhgiabuu/proxypal

ProxyPal is a desktop application that provides a local proxy server to use AI subscriptions from providers like Claude, ChatGPT, Gemini, Qwen, iFlow, Vertex AI, and GitHub Copilot within any OpenAI-compatible coding tool. It supports integration with clients such as Cursor, Cline, Continue, and Claude Code, and includes utilities for detecting installed CLI agents and managing API keys.

Tokens
35.7K
Snippets
133
Records
170
Agent score
78%

What's inside ProxyPal

  1. Supported AI Providers and Clients

    main

    ProxyPal acts as a bridge between various AI providers and coding clients using an OpenAI-compatible interface.

    Supported AI Providers

    • Claude
    • ChatGPT
    • Gemini
    • Qwen
    • iFlow
    • Vertex AI
    • Custom OpenAI-compatible endpoints
    • GitHub Copilot Bridge: Access Copilot models via an OpenAI-compatible API
    • Antigravity Support: Access thinking models through the Antigravity proxy

    Supported Clients

    ProxyPal works with any OpenAI-compatible client, including:

    • Cursor
    • Claude Code
    • OpenCode
    • Cline
    • Continue
    • GitHub Copilot
  2. Verify CLI Agent detection

    main

    ProxyPal detects installed CLI agents by scanning common installation paths rather than using the which shell command (to ensure compatibility with sandboxed macOS environments).

    When verifying agent detection in the Dashboard > Agent Setup section, the application scans the following paths:

    • /opt/homebrew/bin (Homebrew ARM)
    • /usr/local/bin (Homebrew Intel)
    • /usr/bin (System)
    • ~/.cargo/bin (Rust)
    • ~/.npm-global/bin (npm)
    • ~/.local/bin (System)
    • ~/go/bin (Go)
    • ~/.bun/bin (Bun)
    • ~/.nvm/versions/node/*/bin (Node via NVM - scanned dynamically)

    If an agent (e.g., claude, gemini, or opencode) is present in these paths, it should show as "installed" in the UI.

  3. Quick Start with ProxyPal

    main

    To use your AI subscriptions (Claude, ChatGPT, Gemini, GitHub Copilot) with any coding tool, follow these steps:

    1. Download: Get the latest version from the Releases page.
    2. Launch: Open the ProxyPal desktop app and start the proxy service.
    3. Authenticate: Connect your AI accounts using OAuth or by providing your existing auth files.
    4. Configure Client: In your coding tool (e.g., Cursor, Cline, Continue), set the API base URL to http://localhost:8317/v1.
    http://localhost:8317/v1
  4. Set up the ProxyPal development environment

    main

    To develop or test ProxyPal locally, ensure you have pnpm and cargo (Rust) installed. Follow these steps to install dependencies and verify the project builds:

    1. Navigate to the project root.
    2. Install Node.js dependencies using pnpm install.
    3. Verify TypeScript compilation with pnpm tsc --noEmit.
    4. Verify Rust/Tauri backend with cd src-tauri && cargo check.

    To run the application in development mode, use:

    pnpm tauri dev

    To build a production version for macOS, use:

    pnpm tauri build

    This will generate the .app bundle in src-tauri/target/release/bundle/macos/ProxyPal.app.

    # Install dependencies
    pnpm install
    
    # Verify builds
    pnpm tsc --noEmit
    cd src-tauri && cargo check
    
    # Start dev server
    pnpm tauri dev
    
    # Build for macOS
    pnpm tauri build
  5. Develop ProxyPal locally

    main

    ProxyPal is built using SolidJS, TypeScript, Tailwind (frontend), and Rust with Tauri v2 (backend). To develop locally, follow these steps:

    Installation and Running

    pnpm install
    pnpm tauri dev

    Running Checks

    Use these commands to verify code quality:

    pnpm check:ts        # Runs tsgo (if installed) or tsc --noEmit
    pnpm check:parallel  # Runs check:ts, lint, and format:check in parallel
    cd src-tauri && cargo check

    Optional TypeScript Optimization

    For faster type checking, you can use tsgo:

    pnpm add -D @typescript/native-preview

    And update your VS Code settings:

    {
      "typescript.experimental.useTsgo": true
    }
  6. How to add a new Agent to ProxyPal

    main

    To extend ProxyPal with support for a new agent, you must perform the following tasks:

    1. Detection Logic: Add the detection logic in src-tauri/src/lib.rs.
    2. Assets: Add a new logo to public/logos/. Ensure the logo uses currentColor to support dark mode.
    3. UI Updates: Update the agents array in the relevant frontend components.
    4. Verification: Test the auto-configuration flow to ensure the agent is detected and set up correctly.
  7. Verify Provider Disconnect and Credential Deletion

    main

    When a user disconnects a provider via Dashboard > Settings, ProxyPal is designed to delete the associated credential files to prevent the provider from being re-detected as connected on restart.

    Verification Steps:

    1. Connect a provider (e.g., Claude).
    2. Disconnect the provider in the Settings UI.
    3. Confirm the success toast appears and the provider card shows as disconnected.
    4. Manually verify that the credential files have been removed from the local directory:
      ls ~/.cli-proxy-api/
      The directory should not contain files with the provider's prefix (e.g., claude-*.json).
    ls ~/.cli-proxy-api/
  8. ProxyPal configuration file locations

    main

    ProxyPal stores its configuration files in the standard system configuration directory under a proxypal folder.

    • Main Config Directory: [Config Dir]/proxypal
    • Proxy YAML File: [Config Dir]/proxypal/proxy-config.yaml

    On most systems, [Config Dir] refers to the directory returned by dirs::config_dir() (e.g., ~/.config/ on Linux or ~/Library/Application Support/ on macOS).

  9. How Copilot authentication works

    main

    When start_copilot is called, ProxyPal manages the authentication lifecycle of the copilot-api bridge:

    1. Process Spawning: ProxyPal spawns the bridge using bunx, npx, or a globally installed copilot-api binary.
    2. Stdout/Stderr Monitoring: A background task listens to the process output. It looks for specific strings like Listening on:, Logged in as, or Server running to confirm successful authentication.
    3. Device Code Detection: If the bridge requires manual GitHub authentication, ProxyPal parses the output for device codes. When detected, it emits a copilot-auth-required event to the UI so the user can complete the login.
    4. Health Polling: ProxyPal polls the bridge's health endpoint (e.g., http://localhost:PORT/v1/models) to confirm the server is ready to accept requests. It will poll for up to 60 seconds to account for slow initializations or manual authentication steps.
  10. How string interpolation works in translations

    main

    The translation function t supports dynamic parameter injection using double curly braces. When calling t(key, params), the system replaces {{paramName}} in the translation string with the corresponding value from the params object.

    Example Translation String: "Hello {{name}}!"

    Usage: t('greeting', { name: 'Alice' }) -> returns "Hello Alice!"

    // Internal implementation detail for context:
    function interpolate(template: string, params?: TranslationParams): string {
      if (!params) return template;
      return Object.entries(params).reduce((result, [key, value]) => {
        return result.split(`{{${key}}}`).join(String(value));
      }, template);
    }
  11. Manage GPT-5 reasoning suffixes

    main

    ProxyPal provides logic to determine which reasoning level suffixes are available for a given model. This ensures consistency between the backend proxy configuration and the frontend Settings UI.

    • Standard GPT-5 models: Support suffixes: minimal, low, medium, high, xhigh.
    • GPT-5.6 variants: Support additional high-end suffixes: minimal, low, medium, high, xhigh, max, ultra.
    // The available suffixes depend on the model prefix
    // If model starts with 'gpt-5.6-', it includes 'max' and 'ultra'
  12. Understand the `LogEntry` data structure

    main

    Logs retrieved via the API are parsed into LogEntry objects. Each entry contains the following fields:

    • timestamp: A string representing when the log occurred. This may be empty if the log format does not include a timestamp.
    • level: A normalized string representing the severity of the log. Supported normalized levels are ERROR, WARN, INFO, DEBUG, and TRACE.
    • message: The actual log message content.

    Log Level Normalization

    The parser normalizes various shorthand or alternative level names into a standard set:

    • ERROR, ERR, E $\rightarrow$ ERROR
    • WARN, WARNING, W $\rightarrow$ WARN
    • INFO, I $\rightarrow$ INFO
    • DEBUG, DBG, D $\rightarrow$ DEBUG
    • TRACE, T $\rightarrow$ TRACE