翻篇收录说明
翻篇网页快照

llama-server Remote Access: SSH, Tailscale or --connect | Automater Intel

https://automater.ai/intel/llama-server-remote-access-coding-agents/

最近抓取:2026-12-03 19:05:06(北京时间)

最近内容变化:2026-12-03 19:05:06(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

llama-server remote access done safely: keep it on loopback behind an API key, then reach it via SSH tunnel, Tailscale Serve or the experimental --connect.

正文摘录

Keep llama-server on loopback behind an API key and never open the front door. Give the agent one relay, SSH or Tailscale Serve, because --connect has no base URL for it yet.Your GPU box sits under a desk at home with a coding model loaded in llama-server. Once you carry your laptop out the door, OpenCode has nothing to talk to. This guide sets up llama-server remote access without opening your home network to strangers. You keep the server on loopback behind an API key, choose one relay to carry traffic to it and point the agent at that relay. When you finish, you tear everything down and run a check that proves nothing still answers. Three relays are worth considering. An SSH local forward needs nothing new if you already log in to the box. Tailscale Serve gives every device on your tailnet an HTTPS address. The third is new. On October 19, 2026, ggml-org published llama.cpp build b11744 on GitHub, and it adds an experimental --connect flag that opens a peer-to-peer tunnel. That flag is why this guide exists this week, but it is also the path least ready for a coding agent. The sections below explain why and link the sources. What you need before starting. You need a working llama-server build, one GGUF model and a shell on both the GPU box and the laptop. You also need either an SSH server you can reach from outside or both machines joined to the same tailnet. Build b11744 or later matters only if you want to try --connect. The worked example uses illustrative names: the GPU box is gpu-box, the model alias is home-coder, and the laptop listens on local port 19931. Every command is documented syntax from the sources linked inline. The responses described are the documented ones, not output from a run performed for this article. On an older build, note that the server’s default port is now 9931; our llama.cpp port change runbook covers that change. If you are still choosing the hardware, home AI without a workstation and the local AI workstation guide cover that layer. This article starts after the model has loaded. Pick the remote path before you touch a flag The relays differ in three ways: who can reach the server, what base URL the agent sees and how you switch the relay off. Decide those first, because the server configuration in the next section is the same for all three. Path Who can reach it What is encrypted Base URL the agent sees Setup cost Teardown Choose it when SSH local forward Anyone who can log in to gpu-box over SSH and runs the forward on their own machine The SSH channel from laptop to gpu-box; the last hop is loopback on the box http://127.0.0.1:19931/v1 on the laptop Low if sshd is already reachable from outside; otherwise add a jump host or a tailnet Ctrl+C the ssh process One laptop, one agent, and you already use SSH Tailscale Serve Tailnet devices your access rules allow, plus anyone you shared the device with Tailnet traffic, ending as HTTPS with an automatically provisioned certificate https://gpu-box.<tailnet>.ts.net/v1 Medium: Tailscale on every device and HTTPS certificates enabled in the tailnet tailscale serve reset Several of your own devices, a phone included --connect (experimental) A client holding the connect code, which still needs the API key A WebRTC data channel, end to end according to PR #28277; public trackers carry signalling only None documented; the llama.cpp web UI is the first intended client Low on the server, but the browser client was still in review on October 21 Restart llama-server without --connect Trying the web UI from a phone; never for unattended agent traffic Use the table as a decision procedure: If the client is a coding agent such as OpenCode, pick SSH or Tailscale Serve. Both give the agent an ordinary HTTP base URL, and --connect does not have one yet. If you need the model on two or more of your own devices, or on a phone with no terminal, pick Tailscale Serve. One command on the GPU box covers every device. If you already reach the box with SSH keys and only one laptop needs access, pick the SSH forward. It adds no new software. If you want to try --connect, use the web UI and treat it as a pre-release feature. Keep an SSH or Serve path for anything you depend on. If you are about to bind the server to 0.0.0.0 and forward a port on your router, stop. The server README says a public deployment needs an API key and a reverse proxy in front of the server. That is a separate project from reaching your own box. SSH and Tailscale Serve both give a coding agent an ordinary base URL. --connect has none documented yet and ships in a pre-release build. Original matrix based on llama.cpp release b11744 and PR #28277, OpenSSH's ssh(1) manual and Tailscale's Serve documentation, fetched Oct 22, 2026. Lock llama-server to loopback with a key All three relays reach the server from the GPU box itself. sshd connects to loopback, Tailscale Serve proxies to http://127.0.0.1, and llama-connect dials the address you bound. The server therefore never needs a LAN address. The README documents three flags for this. --host defaults to 127.0.0.1, and --port defaults to 9931. --api-key-file reads keys from a file, one per line, and treats lines starting with a hash as comments. The file can hold several keys, which matters when you rotate them later. Pick the relay that fits; every path ends at loopback, where the API key still applies. The --connect lane is dashed because the flag is experimental. Original diagram based on the llama.cpp server README, PR #28277, OpenSSH's ssh(1) manual and Tailscale's Serve documentation, fetched Oct 22, 2026. Create the key file on gpu-box. Generate a long random value in your password manager and put it on the first line of the file. Restrict the file so only your user can read it. Start the server with an explicit loopback bind, the key file, a stable model alias and the context size you plan to give the agent. Run the three checks below on the box itself before you add a relay. # On gpu-box. Paths, alias and context size are illustrative. mkdir -p ~/.config/llama ${EDITOR:-nano} ~/.config/llama/keys.txt # line 1: your key; lines starting with # are comments chmod 600 ~/.config/llama/keys.txt llama-server -m ~/models/coder.gguf --alias home-coder -c 32768 \ --host 127.0.0.1 --port 9931 \ --api-key-file ~/.config/llama/keys.txt Each choice has a reason: --host 127.0.0.1 repeats the default on purpose. The README says a command-line argument takes precedence over its environment variable, so the explicit flag overrides a stray LLAMA_ARG_HOST left in a service file. --alias home-coder replaces the model ID, which otherwise defaults to the file path. The agent configuration needs that ID, and a short alias still works if you rename the GGUF. -c 32768 fixes the context size, so the limit you declare to the agent matches the server. Leave --tools and --agent off. The README lists the built-in tools, including exec_shell_command and write_file, as experimental and says not to enable them in untrusted environments. A server reachable from a café counts. Now check the baseline: # On gpu-box. Endpoints and responses are documented in the server README. export LLAMA_KEY="$(head -n 1 ~/.config/llama/keys.txt)" curl http://127.0.0.1:9931/health # expect {"status": "ok"}; while the model loads, a 503 error with "Loading model" curl http://127.0.0.1:9931/v1/models # expect an error object with "code": 401 (no key sent) curl --header "Authorization: Bearer $LLAMA_KEY" http://127.0.0.1:9931/v1/models # expect a list whose data[0].id is "home-coder" Read the results in this order: /health returning {"status": "ok"} means the model has loaded. The README marks this endpoint as public, with no API key check, so a success here says nothing about authentication. The /v1/models call without a key must fail with a 401 error object. The README’s example message is Invalid API Key. The wording for a missing key may differ, so check the code. If you get the model list instead, the server did not load the key file, and you need to fix that before going further. The call with the key must list home-coder. If the ID shown is a file path, the alias did not apply. From a second machine on your home LAN, request http://<gpu-box-lan-ip>:9931/health. It should fail to connect, because nothing listens on the LAN address. This failure means the bind is correct. SSH local forward: one laptop, one agent The ssh(1) manual documents the form -L [bind_address:]port:host:hostport. ssh listens on a local port and carries each connection over its encrypted channel. The remote machine then opens the connection to host:hostport. Because the remote end makes that connection, a host of 127.0.0.1 means the GPU box’s own loopback, which is where the server listens. You must be able to reach sshd from outside your home. You may already expose SSH with key-only login. You can also reach the box through a jump host with the documented -J option, or run SSH over a tailnet. Use whichever you already trust, so this setup adds no new exposure. # On the laptop. Documented ssh(1) options; host names are illustrative. ssh -N \ -L 127.0.0.1:19931:127.0.0.1:9931 \ -o ExitOnForwardFailure=yes \ you@gpu-box.example.net # The same forward through a jump host: # ssh -N -J you@bastion.example.net -L 127.0.0.1:19931:127.0.0.1:9931 you@gpu-box What each part does: -N runs no remote command. The manual says this is useful when you only want to forward ports. The terminal shows no prompt while the forward is up. The leading 127.0.0.1: is the bind address. The manual says a localhost bind address keeps the listener for local use only. An empty address or * opens it on every interface, which you do not want on café Wi-Fi. Never add -g, which lets remote hosts connect to local forwarded ports. Local port 19931 avoids a clash if the laptop runs its own llama-server on 9931. ExitOnForwardFailure=yes makes ssh exit when it cannot set up the forward, for example when 19931 is already in use. Without it, ssh