Claude Code Remote Access from Your Phone: Tailscale Setup for a Home Server or VPS (2026)
Claude Code and Codex do not need to run on your phone: run them on an always-on home machine or VPS and reach that box over a private Tailscale network. Install Tailscale on both, sign in to the same tailnet, run tailscale up on the box, and connect by its tailnet name; tailscale serve publishes a dev-server preview to that tailnet with no public port. As of 2026-12-02 the Personal plan is $0 with up to 6 users and unlimited user devices, and the API key stays on the box.
QCode is an independent third-party API service, not affiliated with Tailscale, NetBird, Cloudflare, ZeroTier, Anthropic or OpenAI. Commands and plan facts were checked on 2026-12-02; check
tailscale serve --helpon your own client for that version's syntax.
Updated 2026-12-03
Key facts
- Tailscale Personal is $0, with up to 6 users, unlimited user devices, 3 ACL groups and 50 tagged resources to start (pricing, 2026-12-02).
- Tailscale clients 1.106.2 and 1.106.3 both shipped on 1 Dec 2026.
- The agent runs on the box, so the phone only carries keystrokes and approvals; if the mesh drops, the process keeps running.
tailscale servekeeps a port inside the tailnet;tailscale funnelpublishes it on the public internet, which is wrong for an agent UI.- On QCode, Claude Code uses
ANTHROPIC_BASE_URL=https://api.qcode.cc/apiwithANTHROPIC_AUTH_TOKEN; Codex usesbase_url = "https://api.qcode.cc/openai"andwire_api = "responses". - NetBird v0.84.0 shipped on 27 Nov 2026 and can be self-hosted; Cloudflare Mesh (formerly WARP Connector) has been part of Cloudflare One since 14 Apr 2026.
- One
cr_key covers Claude on the Anthropic endpoint and GPT on the OpenAI endpoint, billed at official API price ×1.0.
Architecture: phone, mesh, box, API
The path has three hops, and only the last one costs money: the phone talks to the box over a private mesh, and the box calls the model API with a key installed there.
phone / laptop --> private mesh --> box running the agent --> api.qcode.cc
Tailscale app, WireGuard, claude or codex in tmux, Claude on the Anthropic API,
SSH client NAT traversal API key stored here GPT on the OpenAI API
What that ordering settles:
- The phone never calls the model API. It opens an SSH session or a browser on a private address; no key reaches a mobile app.
- Quota is spent on the box. Every token is billed to the key configured there, so watching from the phone changes nothing.
- The mesh is only a path. If Tailscale drops, the session survives and reappears when the path does.
- The box must stay awake. A sleeping laptop takes the session with it.
Tailscale setup: four steps, no open ports
Install the client on both machines, sign in to the same tailnet, turn on SSH on the box, and address it by its tailnet name — no port forwarding, no public IP, no dynamic DNS.
1. Install on both sides
Install the official client on the box (Linux, macOS or Windows) and the Tailscale app on the phone, then sign in with the same account. Rename the box in the admin console to something short.
2. Bring the box up
Run the client on the box and check what the tailnet sees:
# On the box (Linux, macOS, or a VPS)
tailscale up
tailscale status
# From the phone or laptop on the same tailnet:
ssh you@box-name # the tailnet name printed by tailscale status
# Share a dev server on port 3000 inside the tailnet only
tailscale serve 3000 # check `tailscale serve --help` for your version's syntax
tailscale status lists peers with their tailnet names and 100.x addresses — the address book for everything else here. If you allow Tailscale SSH in your tailnet policy, the phone connects without a key file; the policy still decides who gets in.
3. Connect from the phone
Open any SSH client, connect to the tailnet name of the box, and you have a terminal on the machine holding the repository, the toolchain and the API key.
4. Publish a preview to the tailnet, not the internet
When the agent starts a dev server, tailscale serve 3000 exposes it over HTTPS on a tailnet-only name and prints the URL; open that on the phone and you get the page you would see on localhost. The syntax varies by client version, so check --help first.
tailscale funnel is the other command people find, and it is wrong here: Funnel publishes the service on the public internet. A dev server started by an agent is effectively a shell into your box, so keep it on serve.
Keep the agent running when the connection drops
A phone changes networks constantly, so the session has to live where that does not matter: run the agent inside tmux or screen.
# On the box: start the agent inside a session that survives an SSH drop
tmux new -s agent
claude
# detach with Ctrl-b then d; later, from any device:
tmux attach -t agent
Leaving Wi-Fi range, switching to cellular or locking the phone then costs nothing: the process keeps running and the next SSH connection reattaches to the same pane. The same holds for codex.
Two failure modes are worth knowing. A sleeping box is the first: a developer reported on X on 2 December 2026 that Codex dies when the host machine sleeps and had to be revived over Tailscale — a home server or small VPS beats a laptop you carry. The second is a VPN slot conflict: a forum post in late November 2026 described another VPN app on the phone competing with Tailscale for the phone's single VPN slot. If the tailnet name resolves but the connection stalls, check which app currently owns the VPN profile and the default route.
If you would rather not work in a terminal on a 6-inch screen, an orchestrator can drive the same box: T3 Code (MIT, T3 Tools Inc.; desktop, web and phone), Orca (MIT, Stably AI; an IDE built around parallel worktrees) or Paseo (Apache-2.0; desktop and mobile, no telemetry) — see the three-way comparison.
Put the API key on the box, never on the phone
Configure the endpoint once on the box, and the phone only ever holds an SSH session: no key in a clipboard, a screenshot or a lost phone's storage.
For Claude Code, export the two variables QCode's Anthropic endpoint expects:
export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_your_key
claude
For Codex, define QCode as a provider in ~/.codex/config.toml and keep the key in an environment variable, not the file:
# ~/.codex/config.toml
model = "gpt-6.2-sol"
model_provider = "qcode"
[model_providers.qcode]
name = "QCode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
env_key = "QCODE_API_KEY"
Then set QCODE_API_KEY in the box's shell profile to the same cr_ value. Details that matter when the key lives on a remote machine:
- Protocol separation is strict. Claude models are served only on the Anthropic endpoint (
https://api.qcode.cc/api) and GPT models only on the OpenAI endpoint (https://api.qcode.cc/openai). A Claude ID sent to the OpenAI path is rejected — the usual result of copying half of each snippet. - One key, both protocols. The same
cr_key covers Claude Code and Codex. Chinese models (GLM, Kimi, DeepSeek, Qwen) sit on both endpoints and are billed at the rate shown on /models. - Alternate hosts.
asia.qcode.ccandus.qcode.ccserve the same paths and accept the same key. - Defaults.
claude-opus-5-5for the Anthropic protocol,gpt-6.2-solfor the OpenAI protocol.
If the agent should run in a container on the same box, the env-var pattern is identical; the Docker and devcontainer walkthrough covers mounts and permissions.
Alternatives to Tailscale for this job
Any private mesh that gives the phone a route to the box works; the differences are who runs the control plane and how much you can self-host.
| Tool | What it is | Self-hosting | Free tier (dated) |
|---|---|---|---|
| Tailscale | WireGuard mesh with a hosted coordination server | Headscale for the control server | Personal $0, 6 users, unlimited user devices, 3 ACL groups (2026-12-02) |
| NetBird | WireGuard mesh, management server published as open source | Yes, including management, signal and relay | Free 5 users and 100 machines; Team €6 per user per month, Business €12 (docs, 2026-11-24) |
| Cloudflare Mesh | Private network inside Cloudflare One; formerly WARP Connector | No, it is a Cloudflare service | Part of Cloudflare One; no published free node count — check your plan |
| ZeroTier | Layer-2 virtual Ethernet | Self-hosted controller is a commercial-licence topic | Personal free: 10 users, 10 devices, 1 network (pricing page, 20 Oct 2026) |
NetBird is the closest swap: the whole stack, management server included, runs on your own VM, and its pricing page lists a free tier for 5 users. Cloudflare Mesh was announced on 14 Apr 2026 as the new name for WARP Connector. ZeroTier has stayed on client 1.16.2 since 20 May 2026; its pricing page lists Personal at 10 users, 10 devices and 1 network.
If the hosted coordination server is unreliable from where the box sits, every option above except Cloudflare Mesh can be self-hosted to some degree. Reachability varies by network and operator; this guide goes no further.
Security checklist for an agent box on a mesh
The mesh removes the public attack surface, but it also puts a machine holding an API key on the same private network as everything you own.
- Default-deny ACLs. Let the phone and laptop reach the box on SSH and the served port; do not let the box reach back into personal devices.
- No Funnel for agent UIs.
tailscale serveis tailnet-only;tailscale funnelis public. A webhook needs a separate, authenticated service — never the terminal. - Bind dev servers to localhost. A server on
0.0.0.0is reachable from the whole tailnet the moment it starts; lettailscale servebe the only door. - Tag the box. A single-purpose tagged device is easier to reason about in ACLs than a laptop that also holds the key.
- Rotate on suspicion. If a key turns up in a screen share or a public gist, replace it in the dashboard first; the key leak and rotation guide has the order of operations.
- Lock the phone. A phone with the mesh app and an SSH client is a credential, so biometrics and a short screen-lock timeout belong in the setup.
FAQ
Can I use Claude Code from my phone?
Yes, but not by installing Claude Code on the phone. Run it on a box — a home server, a mini PC or a VPS — and connect from the phone over SSH on a private mesh such as Tailscale. The phone is a terminal and an approval screen; the model work happens where the repository is.
Does the phone use my quota?
No. Quota is spent by the API key configured on the box, whichever device is watching. Two phones and a laptop share the same session and key, so the daily quota is the box's quota. Signing in to a subscription on the phone instead is a different setup, with its own limits.
Is Tailscale free for this?
The Personal plan is $0 with up to 6 users, unlimited user devices, 3 ACL groups and 50 tagged resources to start, checked on 2026-12-02. That covers a developer with a phone, a laptop and one or two boxes; paid plans add users and audit features.
What is the difference between tailscale serve and Funnel?
tailscale serve publishes a local port to your tailnet only, so the URL works on your phone and nowhere else. tailscale funnel publishes the same service on the public internet with a real HTTPS certificate. For a private preview, use serve; for an agent UI, never Funnel.
What happens if my laptop sleeps?
The session dies with the machine. The mesh cannot wake a suspended laptop, and the agent cannot reconnect from a box that is not running. Use an always-on server or VPS for the agent, keep the laptop as a client, and run the session inside tmux so a dropped SSH connection alone never kills it.
Do I need a public IP or port forwarding?
No. Tailscale builds a WireGuard path between the devices, using NAT traversal and relaying when a direct path is not possible. The box can sit behind a home router with no forwarded ports while the phone is on cellular.
Can I run Codex on the same box?
Yes. Codex reads ~/.codex/config.toml, so define QCode as a provider there with base_url = "https://api.qcode.cc/openai" and wire_api = "responses", set the key in an environment variable, and start it in another tmux window.
Run the agents all day on one key
A box that stays on and a mesh that stays private are the infrastructure; the tokens are the running cost. QCode's Daily 35 plan ($53.57) gives that machine a daily quota that resets at 00:00 Beijing time, on one cr_ key covering Claude on the Anthropic API and GPT on the OpenAI API. Anthropic and OpenAI models are billed at official API price ×1.0, so an agent on a home server costs the same per token as one at your desk.