Asyx CLI
Turn localhost:3000 into https://yourname.tunnel.asyx.ai in one command.
Coding assistants—Cursor, Claude Code, Copilot, Windsurf, and others—build apps that run on your machine. Stakeholders cannot see that work until you share a public URL. Asyx closes that gap: install the CLI, enroll once, then tunnel whatever port your dev server uses.
Free account — asyx.ai/register (email + magic link; no invite code).
Full documentation: https://www.asyx.ai/docs
Publish what your agent built
Agent writes code → dev server starts → asyx tunnel → share HTTPS link
| Step |
Who |
What to do |
| Account + enroll |
You (once per machine) |
asyx setup after registering |
| Build / edit code |
Agent |
Implements the feature locally |
| Start dev server |
Agent or you |
npm run dev, vite, flask run, etc. |
| Open public URL |
Agent or you (terminal) |
asyx tunnel --http --port <port> --to <your hostname> |
| Share the link |
You |
PR comment, Slack, email, client review |
Enrollment is human-gated (browser verification) so prompts alone cannot open tunnels from an unbound machine. After asyx setup, your agent only needs the port and one tunnel command.
60-second path to a public link
npm install -g asyx # 1. install (Node 18.17+)
asyx setup # 2. enroll once — approve in the browser; it prints your hostname
npm run dev # 3. start your app (note the port, often 3000 or 5173)
asyx tunnel --http --port 3000 --to yourname.tunnel.asyx.ai # 4. second terminal
Share https://yourname.tunnel.asyx.ai. Press Ctrl+C in the tunnel terminal when the demo ends. (--to names the address the tunnel serves; leave it out and the tunnel serves this device's default address, the one asyx setup printed. The console shows each address's ready-made commands.)
Works with React, Next.js, Vite, Flask, FastAPI, Express, static sites, local LLM UIs—anything speaking HTTP on localhost.
Prefer no global install?
npx asyx@latest tunnel --http --port 3000 --to yourname.tunnel.asyx.ai
Copy-paste for your agent
Add this to a Cursor rule, Claude project, or task prompt:
PUBLISHING CONTRACT — Asyx tunnel
Prerequisites (human completes once per machine):
- asyx CLI installed (npm install -g asyx)
- asyx setup completed (browser enrollment). An agent may start it with
`asyx setup --json` (add --hostname NAME or --random to pick the name) and
show the approval link to the human; the human approves with the code shown.
When a local HTTP server is running on PORT:
1. Run: asyx tunnel --http --port PORT --to HOSTNAME
2. Return https://HOSTNAME as "public_demo_url"
3. Do NOT read, print, or commit ~/.asyx/ or any private.pem files
4. Stop tunnel with Ctrl+C when the user says the demo is over
If asyx setup was never run, tell the human to run it before tunneling.
If the tunnel exits with code 75, the address already has a tunnel of
that kind: report it to the human; do not add --replace unless told to.
Replace PORT with the actual port (e.g. 3000, 5173, 8080) and HOSTNAME with your address (e.g. orders-api.tunnel.asyx.ai: printed by asyx setup and shown in the console).
Example Cursor prompt
Implement the settings page, run the dev server on port 3000, then run
asyx tunnel --http --port 3000 --to orders-api.tunnel.asyx.ai
and give me the public demo URL. I already ran asyx setup on this machine.
Can the agent run the tunnel itself? Yes—if your IDE grants terminal access and asyx is installed. Many teams run the tunnel command themselves for visibility.
More guides: AI agents · Cursor + Asyx · Agent checklist · Publish in 60 seconds
Install & update
npm install -g asyx # install
npm update -g asyx # upgrade
npm uninstall -g asyx # remove
Node.js 18.17+ recommended.
One-time device setup
asyx setup
- Prints an approval link and a short code, and opens your browser. Sign in, check the code matches your terminal, and press Approve. Only approve a setup you started yourself—never a link someone sent you.
- The terminal never asks questions; it waits up to 10 minutes for the approval, then reports the device's hostname.
- Provisions a device certificate and client ID under
~/.asyx/certs/<clientId>/. The private key never leaves the machine.
- Hardware fingerprint is hashed locally; raw attributes never leave the device.
- Running
asyx setup again on the same machine keeps the same device and hostname (it renews the certificate).
- Run
asyx setup on each host you want to trust—certificates are single-device.
Addresses, devices and names
Hostnames and ports belong to your account, not to one computer. Any device you have set up can serve any address of your account: name it with --to <hostname>. Without --to, a device serves its default address, the hostname it got at setup (an app serves only its own address). Your first device uses your account's name; setting up a further device adds an address for it:
asyx name check orders-api # is orders-api.tunnel.asyx.ai available? (no setup needed)
asyx setup --hostname orders-api # enroll this machine with that name
asyx setup --random # or a generated name such as quiet-otter-482
asyx setup --address fast # use one of your addresses as this device's default (also changes it on a device already set up)
asyx setup # or choose on the approval page (it proposes <machine>-<account>)
asyx name add orders-api # add orders-api.tunnel.asyx.ai to your account from a set-up device
Names use 3–30 characters: lowercase letters, digits and hyphens, starting and ending with a letter or digit. Some names are reserved. How many devices and addresses an account can have depends on its plan.
For agents and scripts: --json and exit codes
With --json, asyx setup prints one JSON object per line on stdout and nothing else:
{"event":"approval_required","url":"https://www.asyx.ai/console/devices?...","code":"ABC-123","clientId":"cli_…","expiresInSeconds":600}
{"event":"enrolled","clientId":"cli_…","hostname":"orders-api.tunnel.asyx.ai"}
On failure the last line is {"event":"error","error":"<code>",…} (with suggestions when a --hostname is not available). asyx name check --json prints {"label","hostname","status","suggestions"}, where status is available, hostname_taken, hostname_reserved, hostname_cooling_down or hostname_invalid.
| Exit code |
asyx setup |
asyx name check |
| 0 |
Enrolled |
Available |
| 1 |
Not approved in time, expired, signed out, or another failure |
Could not check (network, rate limit) |
| 2 |
Invalid options |
Invalid usage |
| 3 |
The --hostname name is not available (nothing was started) |
Not available |
HTTP tunnels (most common)
asyx tunnel --http --port 3000 --to orders-api.tunnel.asyx.ai
- Forwards to your app on localhost (loopback only; works whether it listens on IPv4
127.0.0.1 or IPv6 ::1).
- Prints the address's stable
https://<hostname>.tunnel.asyx.ai URL (the same on every start, from any of your devices).
- If your app stops answering, the tunnel stays up: the terminal says so, visitors see a "not reachable" page, and the terminal tells you when the app is answering again.
- TLS and token refresh handled automatically; your app keeps its port.
- If the connection drops (network loss, laptop wake, Asyx server maintenance), the CLI reconnects on its own and the same URL comes back.
Private demos (QuickPass)
For client-only or team-only previews—not open to the whole internet:
asyx tunnel --http --port 3000 --to orders-api.tunnel.asyx.ai --secgroup reviewers
Guests enroll via QuickPass; the relay enforces membership. See https://www.asyx.ai/docs/quickpass
Other tunnel types
All tunnels are loopback-only. The CLI forwards to your existing listener—it never binds your app port.
TCP — databases, SSH, games:
asyx tunnel --tcp --port 5432 --to orders-api.tunnel.asyx.ai
asyx tunnel --tcp --port 5432 --to orders-api.tunnel.asyx.ai --external-port 10003 # a specific public port
UDP — games, realtime apps:
asyx tunnel --udp --port 27015 --to orders-api.tunnel.asyx.ai [--external-port <publicPort>]
Minecraft — shortcut with SRV record (players use hostname only):
asyx tunnel --minecraft --to orders-api.tunnel.asyx.ai [--port 25565] [--name <alias>]
Public ports. Your account has 10 TCP and 10 UDP public ports (its block). For TCP and UDP the port is the address: all your hostnames point at the same server, so fast.tunnel.asyx.ai:10000 and slow.tunnel.asyx.ai:10000 reach the same tunnel. The hostname a port was last opened under is its label:
- An address gets a port of each kind the first time it opens a TCP or UDP tunnel and keeps it: every restart, from any of your devices, uses the same public port.
--external-port <p> opens a specific port of your block under the address you name. If that port is labelled for another of your addresses and nothing is running on it, its label moves and the CLI says so (Port 10000 moved from fast to slow.). If a tunnel is running on it, you are told where; add --replace to take it over.
- A port used by an app's address stays with the app; release it first to use it elsewhere.
- Labels never move by themselves, and ports are not released automatically: release one with
asyx port release --tcp 10003 (or --udp) or in the console, or delete its address. A port with a running tunnel is not released.
After a tunnel opens, the CLI prints the public hostname (and port for TCP/UDP) plus the local target (tcp://127.0.0.1:<port> or udp://127.0.0.1:<port>).
If the connection of a TCP or UDP tunnel drops (network loss, Asyx server maintenance, or Asyx moving your tunnel to another server), the CLI reconnects on its own and keeps the same hostname and public port. Visitor connections that were open at the moment of the drop end; new ones work as soon as the tunnel is back, usually within seconds. If the service closes the tunnel's lease while the CLI is still running (for example after the computer slept through it), the tunnel reopens on the same hostname and port by itself and says so. The CLI ends if another tunnel took the address over with --replace, if reopening is refused, or if it cannot reconnect for 15 minutes.
| Variable |
Effect |
ASYX_TUNNEL_RECONNECT=0 |
Turn reconnecting off (the tunnel ends on a drop) |
ASYX_TUNNEL_RECONNECT_MAX_MS |
Give up after this long without a connection (default 15 minutes) |
ASYX_TUNNEL_RECONNECT_MAX_DELAY_MS |
Longest wait between attempts (default 5 seconds) |
One tunnel of each kind per address
An address runs one HTTP, one TCP and one UDP tunnel at a time. If you start a second tunnel of the same kind for an address that already has a live one — from a second terminal or from another computer — it is refused with the reason, and the running tunnel is not affected:
❌ orders-api.tunnel.asyx.ai already has an HTTP tunnel from this computer since 2:02 PM (serving localhost:3000).
One address runs one HTTP tunnel at a time.
Stop that tunnel first, or add --replace to take over.
- Restarting is fine. When a tunnel stops (it tells the service) or crashes, the address is free again within a second. If you restart faster than that on the same computer, the CLI waits up to 15 seconds for the old tunnel to close.
--replace takes over on purpose (for example when you move a service to another computer). The old tunnel is told who replaced it, stops, and does not reconnect.
--wait keeps trying every 30 seconds instead of exiting, for scripts that should start as soon as the address is free.
--json prints the refusal as {"error":"address_in_use","kind","hostname","since","machine","sameComputer","localPort","retryable"} (and {"error":"replaced",…} for a tunnel that was taken over).
A refused tunnel and a replaced tunnel exit with code 75 ("try again later").
Running a tunnel as a service (launchd, systemd, a Windows service): add --wait. A tunnel started while the address is busy then waits instead of exiting, and if another computer takes the address over with --replace, the restarted service waits quietly instead of taking it back — two computers never fight over an address.
asyx tunnel --http --port 3000 --to orders-api.tunnel.asyx.ai --wait
With systemd you can also skip the restart entirely with RestartPreventExitStatus=75.
Messages name the other computer by its name; they never contain an IP address.
Command quick reference
asyx help # commands; asyx tunnel --help for tunnel options
asyx --version
asyx setup [--hostname <name> | --random | --address <name>] [--json]
asyx name check <name> [--json]
asyx name add <name> [--json]
asyx port release --tcp <port> | --udp <port> [--json]
asyx tunnel --http --port <n> --to <hostname> [--secgroup <slug>]
asyx tunnel --tcp --port <n> --to <hostname> [--name <alias>] [--external-port <p>]
asyx tunnel --udp --port <n> --to <hostname> [--external-port <p>]
asyx tunnel --minecraft --to <hostname> [--port <n>] [--name <alias>]
# any tunnel: --replace --wait --json (without --to: this device's default address)
What's new in 0.9.2
Minecraft records follow a moved port — when a TCP port moves to another of your addresses (--to slow.tunnel.asyx.ai --external-port 10000), its Minecraft record moves too, and the CLI says so: Minecraft players now find it at slow.tunnel.asyx.ai. If the new address already has a Minecraft record for another port, that one stays and the CLI tells you.
What's new in 0.9.1
The live line names your public address — an HTTP tunnel now prints Tunnel live at https://<your address> and then Forwarding to http://localhost:<port>, instead of only the local address.
Approval opens on the Devices page — the link asyx setup prints now opens asyx.ai/console/devices, where the new computer is approved above your device list. Links printed by older versions still work.
What's new in 0.9.0