Getting Started with OpenCode Router
Welcome to OpenCode Router, an intelligent proxy discovery and routing manager designed specifically for OpenCode on Linux.
What is OpenCode Router?
When working with command-line AI coding assistants, developers frequently experience network interruptions:
- Regional ISP blocks and deep packet inspection (DPI) severing TLS handshakes (
ECONNRESET). - Connection timeouts (
ETIMEDOUT) when accessing model provider APIs. - HTTP 429 Too Many Requests throttling on shared public endpoints.
Standard VPN clients solve this crudely by creating a system-wide TUN network adapter that intercepts all traffic on your machine (0.0.0.0/0). This frequently terminates active SSH connections, breaks local Docker bridges, and risks DNS leaks.
OpenCode Router provides a clean, application-specific solution:
- It manages an unprivileged local user-space proxy (SOCKS5 on port
10808and HTTP on port10809). - It discovers public V2Ray/Xray configurations from GitHub, ranks them by latency, and runs deterministic 3-stage health checks.
- It routes OpenCode strictly through a dedicated launcher script (
bin/opencode-vpn) without modifying host network routing or DNS settings.
3-Minute Quickstart
Step 1: Clone and Install
git clone https://github.com/EhsanCreator/OpenCode-Router.git
cd OpenCode-Router
npm installStep 2: Start the Application
./start.shThe startup script automatically downloads the headless Xray-core binary if missing, builds the modern React frontend, and launches the web dashboard at http://localhost:3000.
Step 3: Find Working Connection
- Open
http://localhost:3000in your browser. - Click Find Working Connection.
- The orchestrator tests candidate nodes sequentially until an active proxy completes a real OpenCode test prompt.
Step 4: Execute OpenCode through Proxy
Run your OpenCode sessions through the dedicated launcher:
bin/opencode-vpn run "Explain TypeScript utility types"Next Steps
- Installation Guide — Detailed requirements and Ubuntu setup.
- OpenCode CLI Integration — CLI flags and system-wide aliases.
- Proxy Architecture — How user-space isolation works.