Skip to main content

locopilot expose

Expose the local API over a public Cloudflare Tunnel.

Source: src/cli/commands/expose.ts

Synopsis​

locopilot expose

No flags. Reads API_PORT from the environment and defaults to 8080.

How it works​

  1. Spawns cloudflared tunnel --no-autoupdate --url http://localhost:<API_PORT>.
  2. Tails stderr (cloudflared writes its progress there) and matches against /https:\/\/[a-z0-9-]+\.trycloudflare\.com/.
  3. Prints the public URL once it appears and saves it to ~/.locopilot/config.json under tunnel.url.
  4. Forwards Ctrl-C to cloudflared so the tunnel closes cleanly when you exit.
Exposing http://localhost:8080 via Cloudflare Tunnel...

Requires cloudflared — https://developers.cloudflare.com/...

✔ Public URL: https://magenta-pony-48.trycloudflare.com

Prerequisites​

You must have cloudflared installed:

PlatformInstall
macOSbrew install cloudflare/cloudflare/cloudflared
Windowswinget install --id Cloudflare.cloudflared
LinuxDownload the latest .deb from Cloudflare Releases

If cloudflared is missing, the CLI prints the platform-appropriate hint and exits with 1.

Why expose?​

  • Test webhook integrations without deploying
  • Share a model with a teammate for an afternoon
  • Demo a fine-tuned model from your laptop

The tunnel URL points directly at your local Fastify API, so anyone with the link can hit POST /v1/chat/completions. Treat it as public — there is no auth on Free tier. If you need auth, log in (locopilot login) and include the API key check in your reverse proxy.

Persisted URL​

The most recent tunnel URL is cached in ~/.locopilot/config.json:

{
"tunnel": {
"url": "https://magenta-pony-48.trycloudflare.com",
"updatedAt": "2026-05-09T14:32:11.000Z"
}
}

Quick tunnels are ephemeral — closing the process terminates the URL. For a stable URL, use a named Cloudflare tunnel or expose via your own reverse proxy.