This guide follows the standing review rule: access control first. KoboldCpp is not safe by default — with no --host flag it listens on all network interfaces and has no password, so anyone on your network can generate text on your hardware. Set the password before you open it up, not after.
Related guide: Related Local AI guide
Set the password, then expose it
koboldcpp.exe --model model.gguf --password YOUR_STRONG_PASSWORD --host 0.0.0.0 --port 5001
The flags reference says --password requires an API key for text generation and most other endpoints, that clients send it as Authorization: Bearer <password>, and that it can also be set with the KCPP_PASSWORD environment variable — use the environment variable in scripts so the password does not sit in shell history. --host 0.0.0.0 makes it listen on the network; without --host it already listens on all interfaces, which is why the password must come first.
Connect from the other device
From the second device, open http://YOUR-PC-IP:5001 in a browser, or point your app at http://YOUR-PC-IP:5001/v1 with the password as the bearer token. Test first that a request without the password fails — if it succeeds, you are talking to a different KoboldCpp process started without the flag. Never use --remotetunnel — which creates a public Cloudflare URL — without a password set, because that URL is reachable from anywhere.
Expected result. We checked the KoboldCpp flags reference for the –password, –host and –remotetunnel flags and the linked guide for the not-safe-by-default warning. We did not run this software ourselves for this guide, so no output here is a recorded result; steps marked UNTESTED were checked against the sources below, not run.
Limits
A password is not encryption: on an untrusted network, put the server behind HTTPS or a VPN as well. The password protects text generation and most endpoints, but check the flags reference for which endpoints stay open. We did not run KoboldCpp, so no connection here is a recorded test.
Sources
- KoboldCpp flags reference — –password: requires an API key for text generation and most other endpoints; clients send it as Authorization: Bearer
; can also be set with KCPP_PASSWORD; –host: the network address KoboldCpp listens on; by default it listens on all interfaces, and if you expose it, set –password; –remotetunnel creates a public Cloudflare URL - KoboldCpp guide — not safe by default: with no –host it listens on all network interfaces and has no password
Checked 2026-11-28.
