The chat server binds toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/techjarves/USB-Uncensored-LLM/llms.txt
Use this file to discover all available pages before exploring further.
0.0.0.0:3333 — all network interfaces, not just localhost — which means it is immediately reachable from any device on the same local network as the host PC. Phones, tablets, other laptops, or any browser-capable device can access the full chat interface without installing anything. No port forwarding, no configuration, and no extra software is required.
How It Works
Whenchat_server.py starts, it automatically discovers the host machine’s LAN IP address using a UDP socket trick: a socket is opened with socket.SOCK_DGRAM, connected to 8.8.8.8 on port 80 — no data is ever actually sent — and the local bound address reported by the OS is read back. This reliably returns the machine’s primary LAN-facing IP (e.g. 192.168.1.15) without requiring ifconfig, ipconfig, or any external commands.
Startup Banner
Every time the server starts, it prints the following to the terminal:Network Access: line shows the exact URL to type into any browser on your local network. The Local Access: URL (localhost) only works on the machine running the server.
Connecting from a Mobile Device
Join the same WiFi network
Ensure the PC running the
start script and your phone or tablet are connected to the same WiFi network. The server is not reachable across different networks or subnets.Find the Network Access URL
Look for the
Network Access: line in the terminal window that opened when you ran the start script. It will show an IP in the form http://192.168.x.x:3333. Copy or note down this address.Open the URL in a mobile browser
Type the full URL (e.g.
http://192.168.1.15:3333) into Safari on iPhone/iPad or Chrome on Android. Do not add https:// — the server uses plain HTTP.Port 3333 and Firewall
The server listens on TCP port 3333. If the chat interface loads on the host PC (localhost:3333) but not on your mobile device, a firewall is almost certainly blocking incoming connections on that port.
Windows:
Windows Defender Firewall may block the connection by default. To allow it:
- Open Windows Defender Firewall → Advanced Settings
- Select Inbound Rules → New Rule
- Choose Port, click Next, select TCP, enter
3333, click Next - Select Allow the connection, click through to finish
python.exe or python3.exe through the firewall:
- Open Windows Defender Firewall → Allow an app or feature through Windows Defender Firewall
- Click Change settings → Allow another app
- Browse to your Python executable (e.g.
Shared\python\python.exeor the system Python) - Ensure both Private and Public are checked
ufw enabled:
firewalld:
CORS Configuration
Two CORS mechanisms work together to ensure browser security policies don’t interfere with mobile access:-
Chat server headers:
chat_server.pyincludesAccess-Control-Allow-Origin: *on every response. This allows the UI, served from the host machine’s IP, to make API calls back to the same server without cross-origin errors. -
Ollama origins: Every start script sets
OLLAMA_ORIGINS=*as an environment variable before launching the Ollama engine:This tells Ollama itself to accept requests from any origin, complementing the chat server’s proxy behaviour.
/ollama/* proxy on the chat server — the Ollama engine at port 11434 is never called directly from the browser, so Ollama’s CORS policy is only relevant at the server-to-server level.
Security Considerations
A few additional notes on the security boundary:- Ollama management port not exposed: The Ollama engine listens on
127.0.0.1:11434(loopback only). It is only reachable externally through the/ollama/*proxy on the chat server, and only after themodelandmessagesfields pass validation. Direct access to Ollama from the network is not possible. - No path traversal: Static file serving in the chat server validates that requested paths resolve within the
Shared/directory before reading. Requests that attempt path traversal (../../) receive a403response. - Chat history is on the USB: All conversation data is stored in
Shared/chat_data/chats.json— on the portable drive, not on the host machine’s disk.
Android LAN Access
When USB-Uncensored-LLM is running on Android via Termux, the same LAN access mechanism applies in reverse: the Android device becomes the AI server and other devices on the WiFi network become clients.- Using a high-RAM Android tablet (12 GB+) as an inference backend for a thin client or low-powered laptop
- Running the 2B model on a phone for a group of people at a location without a PC
Android’s Termux environment may require running
termux-wake-lock before starting the server to prevent the OS from suspending the process when the screen turns off. Run termux-wake-lock in a separate Termux session before executing bash Android/start.sh.