WS Model Proxy Overview & Quick Start
Deploy WS Model Proxy on a VPS or home server, enroll your first compute node over outbound WebSockets, and make your first /v1/chat/completions call.
WS Model Proxy (WMP) is a self-hosted web application and Rust node client (wsmp) that exposes local inference servers running on your own machines through a single OpenAI- and Anthropic-compatible API—without router port forwarding or inbound firewall holes.
Use it to unify models running at home or in a lab, manage and switch runtimes across nodes, share logical model pools with collaborators, and optionally fall back to cloud providers under explicit per-pool consent and monthly spend caps.
Architecture
One Docker container (Hono server, React dashboard, oRPC API, MCP server, and WebSocket relay) runs alongside PostgreSQL 17. Each compute machine runs wsmp, which opens a single outbound WebSocket (/api/cli/ws) to the server and proxies requests to its local inference engines.
Browser / API Client / MCP Agent
│
▼ HTTPS (TLS terminated at proxy or Cloudflare edge)
Reverse Proxy (Caddy / Traefik / nginx) or cloudflared
│
▼ HTTP on 127.0.0.1:3000
┌──────────────────────────────────────────────────────────┐
│ WS Model Proxy Server │
│ • React Web App + oRPC API + Better Auth │
│ • OpenAI / Anthropic / Audio / Realtime API (/v1/*) │
│ • MCP Server (/mcp) + OAuth 2.1 / DPoP │
│ • WebSocket Relay (/api/cli/ws) │
└──────────────┬───────────────────────────┬───────────────┘
│ │
▼ ▼ (optional :external fallback)
PostgreSQL 17 Cloud Providers (OpenRouter / Generic)
▲
│ One outbound WSS per node (/api/cli/ws)
┌───────────┴───────────┐
│ wsmp Node Client │ (Linux, macOS, Windows 11, WSL2)
│ • Relay / Full trust │
│ • Local inference │──▶ vLLM, SGLang, llama.cpp, Ollama, Docker Compose
└───────────────────────┘
WMP stores only content-free usage, routing, and cache-affinity metadata—never prompts, chat messages, audio, or transcripts. Native /v1/responses calls default to store: false.
Prerequisites
- Server host: Docker and Docker Compose (or Dokploy / another single-container platform), plus an HTTPS reverse proxy (Caddy, Traefik, nginx) or a Cloudflare Tunnel.
- Database: PostgreSQL 17 (included in the shipped
compose.yaml). - Node machines: Linux (
x86_64orarm64), macOS (Apple silicon or Intel), or Windows 11 (x86_64; ARM64 runs thex86_64binary). Buildingwsmpfrom source requires Rust 1.89+ and a C toolchain.
Server Quick Start (Docker Compose)
The prebuilt application image is published to GitHub Container Registry:
ghcr.io/flycockpit/ws-model-proxy:vX.Y.Z
ghcr.io/flycockpit/ws-model-proxy:X.Y.Z
ghcr.io/flycockpit/ws-model-proxy:sha-<commit-sha>
ghcr.io/flycockpit/ws-model-proxy:latest
1. Create a private environment file
Store secrets outside the repository checkout (for example /etc/wsmp/private.env with mode 0600). You can generate strong values interactively from a checkout with pnpm generate:secrets, or create the file directly:
POSTGRES_PASSWORD=replace-with-random-hex-password
BETTER_AUTH_SECRET=replace-with-at-least-32-random-characters
BETTER_AUTH_URL=https://models.example.com
TRUST_PROXY_HOPS=1
ADMIN_EMAIL=you@example.com
Important:
TRUST_PROXY_HOPSis required in production (the server refuses to start without it). Set it to the exact number of reverse proxies that append toX-Forwarded-For(1behind Caddy, Traefik, nginx, or a directcloudflaredtunnel;2whencloudflaredsits in front of a local reverse proxy).
2. Start the server and PostgreSQL
docker compose --env-file /etc/wsmp/private.env up -d --build
By default, compose.yaml binds the web service to loopback only (127.0.0.1:3000, overridable via WEB_PORT), keeps PostgreSQL unpublished on the internal Docker network, sets stop_grace_period: 52s, and applies pending Prisma migrations automatically on startup (MIGRATE_ON_START=true).
Note: Point your HTTPS reverse proxy to
http://127.0.0.1:3000and enable response compression at the proxy (for example Traefik’scompressmiddleware). On Dokploy—which listens on host port 3000 itself—remove theports:block and attach your domain directly to serviceappon port3000.
3. Bootstrap the first admin account
Public signup is closed by default (SIGNUP_ENABLED=false). Open https://models.example.com and sign up using the exact address configured in ADMIN_EMAIL. Only that address can create the initial admin account on a fresh production database.
SMTP is optional: without it, email/password authentication works immediately and email verification is off. Configure SMTP_* variables later if you want email verification, self-service password resets, or email 2FA codes.
Install the wsmp Node Client
Warning: WS Model Proxy 1.0 speaks relay protocol 4.0 (
ws-model-proxy.relay.v4) and refuses0.4.xCLIs with HTTP 426. Keep server and nodes on 1.0+.
Linux and macOS (recommended)
Every server hosts its own version-matched installer at /install.sh:
curl -fsSL https://models.example.com/install.sh | sh
The script downloads the release binary matching the server’s version into ~/.cargo/bin ($CARGO_HOME/bin when set) and verifies its SHA-256 against the release’s sha256.sum (refusing to install on any mismatch or missing checksum):
- Linux with glibc 2.34+ (Debian 12+, Ubuntu 22.04+, Fedora, Arch): installs the glibc build (
*-unknown-linux-gnu) so system NSS and*.localmDNS hostnames resolve normally. - Alpine or older glibc: installs the static musl build (
*-unknown-linux-musl). Note that static musl cannot resolve*.localmDNS names; use/etc/hostsor an IP literal there. - Other platforms (or when the server pins
WMP_CLI_SOURCE_REV): builds the release tag from source with Cargo (Rust 1.89+ and a C compiler).
Note: On Linux, install and run
wsmpunder a regular non-root user account (withvideo/rendergroup membership for GPU engines).wsmp service installrefuses to run as root because every runtime, command, and terminal runs as the daemon’s OS user.
Windows 11
Run the server’s PowerShell installer (Windows PowerShell 5.1 or PowerShell 7):
irm https://models.example.com/install.ps1 | iex
This verifies wsmp-x86_64-pc-windows-msvc.zip against sha256.sum and installs it to %USERPROFILE%\.cargo\bin. Install PowerShell 7 (winget install Microsoft.PowerShell, MSI build—not the Microsoft Store package) for runtimes and node commands. For Linux-only engines like vLLM and SGLang on Windows, run the Linux wsmp binary inside WSL2 with systemd enabled.
Homebrew, GitHub Releases, or Source Build
# Homebrew (remove before switching to /install.sh so it does not shadow ~/.cargo/bin/wsmp)
brew install flycockpit/tap/wsmp
# Direct GitHub Release installer (Linux / macOS)
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/FlyCockpit/ws-model-proxy/releases/latest/download/wsmp-installer.sh | sh
# Build from source (Rust 1.89+)
cargo install --git https://github.com/FlyCockpit/ws-model-proxy --tag v1.0.0 --locked wsmp
You can also verify any downloaded release archive’s SLSA build provenance with:
gh attestation verify wsmp-aarch64-unknown-linux-musl.tar.xz --repo FlyCockpit/ws-model-proxy
Enroll a Node and Make Your First API Call
- Create an enrollment code: In the web app, go to Nodes → Add a node and generate a one-time code (
wsmp_enr_...). - Enroll the machine:
The prompt asks for the node slug, trust level (Full control or Relay only), whether to allow browser terminals, and whether to install and start the per-user background service (wsmp login https://models.example.com --code wsmp_enr_...wsmp service install). - Add a runtime: Go to Runtimes → New runtime and either register an always-on inference endpoint already listening on the node (for example
http://127.0.0.1:8000) or create a startable runtime from a preset (vLLM, SGLang, llama.cpp, Docker Compose) and start it. - Create a pool: Go to Pools → New pool and attach one or more served models. Note its callable ID, which has the form
owner/pool(for examplealice/qwen3). - Create an API key: Go to Access → API keys, create a key scoped to all pools or specific pools, and copy the
wsmp_key_...value. - Verify
/v1/modelsand send a completion request:
export WSMP_SERVER_URL="https://models.example.com"
export WSMP_API_KEY="wsmp_key_..."
# List callable pool IDs for this key
curl --fail-with-body \
-H "Authorization: Bearer $WSMP_API_KEY" \
"$WSMP_SERVER_URL/v1/models"
# Call /v1/chat/completions
curl --fail-with-body \
-H "Authorization: Bearer $WSMP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "alice/qwen3",
"messages": [{"role": "user", "content": "Say hello in five words."}]
}' \
"$WSMP_SERVER_URL/v1/chat/completions"
If a model does not appear in /v1/models, verify four things in order: (1) wsmp status shows a connected relay, (2) wsmp runtime list shows a ready instance, (3) wsmp runtime test <slug> returns a healthy response, and (4) the served model belongs to a pool covered by your API key.
Known Limitations
- Single web container only: Authentication, failed-sign-in, and MCP rate limits are process-local in memory. Do not run multiple web replicas behind a load balancer in v1.
- No transaction-mode Postgres poolers: PgBouncer
pool_mode=transactionis unsupported because the server relies on persistent sessionTimeZone=UTCand per-connection timeouts. - Bearer-only
/v1/*API: Browser session cookies and permissive cross-origin CORS are intentionally unsupported on/v1/*routes. Use the dashboard Test page for browser testing. - Scheduled schema deletions (
contract.sql) wait in 1.0: The 1.0 release does not run an instance readiness heartbeat, so deferredcontract.sqldrops never become due automatically (fail-safe; 1.0 ships nocontract.sqlfiles). - Host access is not a sandbox: On Full-control nodes, node commands and file tools run with the full OS privileges of the
wsmpuser account. Guardrails (allowed file roots, output redaction, subcommand blocks) are not an OS isolation boundary. - Windows platform limits: Native Windows 11 supports llama.cpp, Ollama, and LM Studio, but not Linux-only engines like vLLM or SGLang (use WSL2 for those). The Windows Task Scheduler relay runs only while logged on and lacks the Unix file-recovery journal (
wsmp recover).