Status: [LIVE] Endpoints found: https://code.claude.com/docs/en/llm https://platform.claude.com/docs/en/api/messages/create Source: https://github.com/heqing7840/switch-local-proxy # Switch Local Proxy [简体中文](README.zh-CN.md) A local AI API proxy with prioritized key routing, automatic failover, retries, cooldowns, and real-time provider monitoring. The proxy accepts OpenAI Responses, OpenAI-compatible Chat Completions, and Anthropic Messages-compatible requests. All adapters share the same provider priority, health, retry, cooldown, and monitoring model. ## Features - Priority-based routing across multiple API keys. - One same-provider retry for an HTTP 502 before failover. - Temporary cooldowns with automatic recovery probes. - Streaming SSE early-error detection before forwarding output. - OpenAI Responses, Chat Completions, and Anthropic Messages pass-through adapters. - Local dashboard for provider status, latency, failures, key hints, model routing, and request history. - Add, edit, delete, enable, disable, reorder, and restore providers from the dashboard. - No database or cloud control plane. Runtime state stays on the local machine. - The service binds to loopback by default and runs as a macOS background LaunchAgent. - `RunAtLoad` starts it at login and `KeepAlive` relaunches it after an unexpected exit; `./run.sh doctor` verifies both guarantees. - A separate no-window Python watchdog checks the health endpoint every 15 seconds and reloads or restarts the service if the job is unloaded, stopped, or unresponsive. - Cross-origin browser writes are rejected, request bodies are capped, and client cookies are never forwarded upstream. - The release gate scans tracked files, new unignored files, all Git history, and the `dist/` allowlist without printing matched values. ## Requirements - macOS with `launchctl`. - Python 3.11 or newer. - An upstream API endpoint compatible with the selected adapter. ## Quick Start ```bash git clone https://github.com/heqing7840/switch-local-proxy.git cd switch-local-proxy python3 -m venv .venv .venv/bin/pip install -r requirements.txt ``` The first launch creates a local SQLite database u