Inspired by dalia-abdallah25/anyrouter-opencode-bridge | RebornQ/AnyRouter-Transparent-Proxy
A local bridge/proxy service designed to enhance API access and bypass common restrictions. It connects local client applications to the upstream AnyRouter API, handling request filtering, tool injection for Claude models, and HTTP/2 transport seamlessly.
This README is designed to be fully self-contained. You can provide this file to any AI assistant (like Claude, ChatGPT, or Gemini), and it will be able to autonomously configure and deploy the service for you.
- HTTP/2 Support: Advanced support using
curl_cffito mimic standard browser fingerprints and bypass WAF checks. - Claude Tool Injection: Seamlessly injects tools and system prompts for Claude models.
- Request Filtering: Removes unnecessary fields from requests that might trigger upstream security blocking.
- Streaming & Non-Streaming: Fully supports streaming chat completions.
- Dashboard GUI: Includes a built-in web dashboard to monitor proxy status and health.
- Multi-Platform Support: Runs on Windows, macOS, and Linux. Included launch scripts for macOS (
LaunchAgent) and Linux (systemd).
- Python 3.10+
- (Optional but Recommended) A virtual environment
git clone https://github.com/leecaa/anyrouter-proxy.git
cd anyrouter-proxypython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThe proxy is configured via a JSON file (proxy_config.json) or environment variables (see .env.example).
Interactive Setup (Recommended):
python main.py --setupManual Setup: Copy the template and edit it:
cp proxy_config.example.json proxy_config.jsonKey Configurations & Ports:
host: The local IP address to bind to. Default is127.0.0.1(only accessible locally). Set to0.0.0.0if you need to access it from other machines.port: The port the proxy and dashboard will run on. Default is 8765.dashboard_password: The password required to access the Web Dashboard. Make sure to set a secure password.target_base_url: Upstream API URL. Default ishttps://anyrouter.top/v1.
Authentication Model:
This proxy uses a transparent passthrough model for API authentication. The proxy does not store or validate API keys itself. Instead, clients must include their own upstream API key in each request (via x-api-key header or Authorization: Bearer token), and the proxy forwards it directly to the upstream service.
python main.pyThe server will start listening on http://127.0.0.1:8765 by default.
Once the proxy is running, you can access the Web Dashboard from your browser to monitor traffic, health, and logs.
- URL: Open
http://127.0.0.1:8765in your web browser. - Login: Enter the
dashboard_passwordyou configured in Step 3.
If you use the Anthropic official claude-code CLI, it has a hardcoded restriction requiring api.anthropic.com. To bypass this, a patch script is provided for node-installed environments:
./patch_claude_api_host.sh(This script replaces api.anthropic.com with anyrouter.top inside the global claude-code npm package. You may need to re-run it after updating claude-code.)
./macos/install.sh
./macos/status.sh
tail -f ~/Library/Logs/anyrouter-proxy.logTo uninstall: ./macos/uninstall.sh
sudo ./linux/install.sh
sudo ./linux/status.sh
journalctl -u anyrouter-proxy -fTo uninstall: sudo ./linux/uninstall.sh
Please review the SECURITY.md guidelines. The proxy uses a transparent API key passthrough model — clients provide their own upstream API key in each request. If binding to 0.0.0.0, ensure proper network-level access controls are in place. Do not commit your .env or proxy_config.json files.
MIT License - see the LICENSE file for details.