Skip to content

Connect OpenCode Mobile on a Local Network

Use a trusted local network when the phone and the OpenCode machine are on the same private Wi-Fi or LAN. This keeps the connection off the public internet, but it still requires authentication and a firewall rule that is limited to the private network.

Terminal window
export OPENCODE_SERVER_USERNAME=your-user
export OPENCODE_SERVER_PASSWORD='use-a-strong-password'
opencode serve --hostname 0.0.0.0 --port 4096

Find the machine’s private address, then enter a URL such as:

http://192.168.1.20:4096

Allow TCP port 4096 only on the private-network firewall profile. Do not forward this port through your router or use this approach on an untrusted network.

Confirm the health endpoint works before opening the app:

Terminal window
curl -u your-user:use-a-strong-password \
http://192.168.1.20:4096/global/health

If the local-network address does not connect

Section titled “If the local-network address does not connect”
  • Use the machine’s LAN address, not localhost or 127.0.0.1.
  • Confirm OpenCode is listening on 0.0.0.0 or the specific LAN interface.
  • Allow the port through the private-network firewall profile.
  • Disable client isolation on the Wi-Fi network if devices cannot reach each other.

For other routes, return to the remote-access overview or use the troubleshooting checklist.