Skip to main content

Documentation 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.

The chat server binds to 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

When chat_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.
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
local_ip = s.getsockname()[0]
s.close()
This detected IP is then printed in the startup banner so you can read it at a glance.

Startup Banner

Every time the server starts, it prints the following to the terminal:
=======================================================
  Portable AI — Chat Server
=======================================================

  Local Access:    http://localhost:3333
  Network Access:  http://192.168.1.15:3333   <-- Use this on phone/other PC!
  Ollama/Llama Proxy: http://127.0.0.1:11434

  All chats auto-save to the USB drive!
  Press Ctrl+C to shut down.

-------------------------------------------------------
The 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

1

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.
2

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.
3

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.
4

Start chatting

The full chat interface loads in the mobile browser. Tap the message box and start a conversation. All messages are routed to the AI engine running on the PC and auto-saved to the USB drive in real time.

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:
  1. Open Windows Defender FirewallAdvanced Settings
  2. Select Inbound RulesNew Rule
  3. Choose Port, click Next, select TCP, enter 3333, click Next
  4. Select Allow the connection, click through to finish
Alternatively, allow python.exe or python3.exe through the firewall:
  1. Open Windows Defender FirewallAllow an app or feature through Windows Defender Firewall
  2. Click Change settingsAllow another app
  3. Browse to your Python executable (e.g. Shared\python\python.exe or the system Python)
  4. Ensure both Private and Public are checked
Linux: Most Linux desktop distributions have no firewall active by default. On Ubuntu Server with ufw enabled:
sudo ufw allow 3333
On Fedora/RHEL with firewalld:
sudo firewall-cmd --add-port=3333/tcp --permanent
sudo firewall-cmd --reload
macOS: macOS typically prompts automatically the first time Python accepts an incoming connection. Click Allow in that dialog. If you dismissed it, go to System Settings → Network → Firewall → Options and allow Python.

CORS Configuration

Two CORS mechanisms work together to ensure browser security policies don’t interfere with mobile access:
  1. Chat server headers: chat_server.py includes Access-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.
  2. Ollama origins: Every start script sets OLLAMA_ORIGINS=* as an environment variable before launching the Ollama engine:
    :: Windows/start-fast-chat.bat
    set "OLLAMA_ORIGINS=*"
    
    # Linux/start.sh
    export OLLAMA_ORIGINS="*"
    
    This tells Ollama itself to accept requests from any origin, complementing the chat server’s proxy behaviour.
All Ollama API calls from the browser go through the /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

The chat server has no authentication, no passwords, and no rate limiting. Anyone connected to the same local network can open the chat UI, send requests to the AI, and read your chat history. Do not run this server on untrusted public WiFi networks (airports, hotels, cafes). For personal home or office use on a trusted private network, this is not a concern.
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 the model and messages fields 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 a 403 response.
  • 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.
bash Android/start.sh
The startup banner prints the Android device’s WiFi IP. Open that URL from any PC or phone on the same network to use the Android tablet’s AI engine remotely. This is particularly useful for:
  • 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.

Build docs developers (and LLMs) love