Quick verdict
All 4 methods avoid opening an inbound port. They differ in who can call the endpoint, how authentication works, and whether they were designed for an API workload.
Threat model for local LLM APIs
Before comparing methods, here’s what can go wrong when you expose a local inference server:
The key principle: a local model API has no built-in user management. Ollama, vLLM, llama.cpp, and LM Studio all expose unauthenticated endpoints by default. Authentication must come from whatever sits in front.
Method 1: SSH tunnels
SSH tunnels forward a local port over an encrypted SSH session. They’re the oldest method here and the most manual.How it works
8000 to your local machine. While the tunnel is open, you call http://localhost:8000 as if the model were local.
Security properties
- Encryption: SSH provides strong encryption.
- Authentication: OS-level credentials (password or key pair).
- Access scope: Whoever holds the SSH key gets full shell access to the machine — not just the API port.
The catch for LLM use
- SSH requires a stable public IP or a jump host. CGNAT blocks it entirely.
- Tunnels drop on network changes and don’t reconnect automatically.
- Each user needs their own tunnel and their own SSH credentials — there’s no concept of a scoped API key.
- No built-in streaming support. Your client needs to handle reconnects on its own.
When to use it
SSH tunnels work for a solo developer testing something quickly. They don’t scale to teammates, agents, or anything that needs to run unattended.Method 2: Tailscale
Tailscale creates a zero-trust mesh network (a “tailnet”) between your devices. Each device gets a stable IP, and traffic flows over encrypted WireGuard.How it works
Security properties
- Encryption: WireGuard with per-device keys.
- Authentication: Device identity verified by the Tailscale coordination server.
- Access scope: Only devices you’ve added to your tailnet can reach the model.
The catch for LLM use
- Every caller must join your tailnet first. That works for your own devices but doesn’t fit teammates, SaaS clients, or coding agents that need an API key — not a VPN.
- Tailscale Funnel can publish a service publicly, but it’s restricted to ports 443, 8443, and 10000. Bandwidth is limited and not configurable.
- No API key management — you manage device access, not per-request authentication.
- The model server still has no auth layer. Anyone on the tailnet can call it with no credential.
When to use it
Tailscale is excellent for personal multi-device access — your laptop reaching your home server, for example. It’s the right tool when you control every device and don’t need to hand out API keys.Method 3: Cloudflare Tunnel
Cloudflare Tunnel (cloudflared) routes traffic through Cloudflare’s edge network with no inbound port required. It acts as a reverse proxy.
How it works
Security properties
- Encryption: TLS from client to Cloudflare edge, then Cloudflare to your origin.
- Authentication: You build it — Cloudflare Access, API tokens, or your own middleware.
- Access scope: Publicly routable by default. You add auth on top.
The catch for LLM use
- Buffering: Cloudflare buffers responses by default unless the response carries a
text/event-streamcontent-type header. SSE streaming can break or lag behind. - Proxy timeouts: Cloudflare’s proxy timeouts are around 100 seconds on the free tier. Long generations (large context, high
max_tokens) can get cut off mid-stream. - No API key layer: You need to add authentication yourself — Cloudflare Access, a middleware, or an API gateway in front.
- Complexity: DNS records, Cloudflare Access policies, and tunnel lifecycle management add up.
When to use it
Cloudflare Tunnel fits when you’re publishing a web application behind Cloudflare’s edge and already use their ecosystem. For a raw inference API, the buffering and timeout behavior make it a poor fit without significant tuning.Method 4: Tokios connector
The Tokios connector is purpose-built for one task: turning a local model endpoint into an authenticated API reachable from anywhere.How it works
1
Install the connector on the model server
Windows
macOS
Linux
2
Register a deployment and create an API key
In the Tokios dashboard, register your model with a public name (for example,
llama3-tunnel), then create a sk-tok-… key scoped to it.3
Call from anywhere
Security properties
- Encryption: TLS from client to
api.tokios.com, then TLS over the outbound tunnel to your machine. - Authentication: Per-request bearer token (
sk-tok-…) with optional model-name scoping. - Access scope: Each API key can be scoped to specific deployments. Revoking a key cuts access immediately without touching the connector or the backend.
Architecture
The connector only dials out tohttps://api.tokios.com. No inbound port is opened on your machine. No DNS record, no public IP, no port forwarding.
When to use it
Tokios fits when you need to:- Share model access with teammates using per-person API keys.
- Connect coding agents (Claude Code, Codex, Cline) that expect a standard OpenAI or Anthropic base URL.
- Work behind CGNAT, corporate NAT, or any network where inbound connections are blocked.
- Avoid building and maintaining your own auth layer.
Comparison matrix
Recommendation by use case
These methods aren’t mutually exclusive. You can run Tailscale for personal device access and Tokios for teammate or agent access on the same machine — they don’t conflict.
What about just opening the port?
SettingOLLAMA_HOST=0.0.0.0, forwarding a router port, or binding vLLM to 0.0.0.0 makes the model reachable — with no authentication at all. Security researchers reported roughly 175,000 exposed Ollama hosts on the open internet (SentinelLABS/Censys, 2026). Internet-wide scanners index exposed services within hours. None of the 4 methods above require you to open an inbound port, and none should be skipped in favor of binding wider.
Your model stays local — your endpoint works everywhere
Whichever method you choose, the principle is the same: your model never leaves your machine, and the endpoint is what you choose to expose. Tokios makes the “expose it securely to multiple users” path the shortest one.Deep dives
Each comparison below goes beyond the table above — covering architecture, failure modes, and the specific workload constraints that make one approach beat another:Tokios vs Tailscale
Device mesh vs API gateway: when peer-to-peer WireGuard is enough and when you need scoped API keys.
Tokios vs Cloudflare Tunnel
SSE buffering, proxy timeouts, and why Cloudflare’s edge can silently break streaming inference.
Tokios vs LiteLLM
Open-source multi-provider proxy vs managed tunnel — and how to stack both together.
Tokios vs DIY stack
The 7-layer self-hosted stack (runtime, proxy, tunnel, auth, TLS, DNS, monitoring) and when building it yourself is worth the hours.
When to use Tokios
A decision framework: CGNAT, team size, agent compatibility, and airgap requirements — which tool fits which constraint.
Quickstart
Pair a connector and register your first model in 2 minutes.
Why outbound-only
The architecture decision and what it eliminates.
vLLM remote access
Step-by-step guide for exposing a local vLLM server.
Hardening checklist
10 steps to secure a self-hosted LLM deployment.