Skip to content

Raghul-M/laptop-local-llm-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Local LLM Server with Ollama + Cloudflare Tunnel

Streamlit -app

This project turns an old laptop into a fully functional AI server that can serve LLMs locally and access them globally using Cloudflare Tunnel on API . A simple Streamlit app provides a friendly frontend to interact with the model via API .

🔗 Blog post: Run a Local AI Server for Free with Ollama & Cloudflare Tunnel

🚀 What You Can Build

  • Personal chatbot
  • Code generation tool
  • Lightweight AI backend for your apps
  • Home AI server on a budget

💻 Requirements

  • A Old laptop with Linux (preferably with 4GB+ RAM)
  • Python 3.9+
  • Ollama
  • Cloudflared

🔧 Setup Instructions

1. Install Ollama and pull models

$ curl -fsSL https://ollama.com/install.sh | sh

$ ollama pull tinyllama  # or any other model like deepseek-llm

2. Serve the model locally

$ OLLAMA_HOST=0.0.0.0 ollama serve

# Or run on a custom port

$ OLLAMA_HOST=0.0.0.0 OLLAMA_PORT=11435 ollama serve

3. Expose with Cloudflare Tunnel

$ wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O cloudflared

$ chmod +x cloudflared

$ cloudflared --version

$ cloudflared tunnel --url http://localhost:11435

This will give you a public URL like:

https://your-unique-subdomain.trycloudflare.com

4. Run the Streamlit App on Client machine

Install dependencies:

pip install -r requirements.txt

Run app:

streamlit run app.py

Make sure to update your app.py with the correct Cloudflare URL.

WhatsApp Image 2025-04-11 at 7 46 12 PM (1)

Example Request

curl https://your-unique-subdomain.trycloudflare.com/api/generate -d '{
  "model": "deepseek-llm:1.5b",
  "prompt": "Write a Python function to reverse a string"
}'

WhatsApp Image 2025-04-11 at 7 46 12 PM

📊 Bonus Tips

  • Use htop or glances to monitor usage
  • Check disk with lsblk and df -h
  • Stick to lightweight models for faster inference

WhatsApp Image 2025-04-11 at 7 46 13 PM (1)

📁 Project Structure

local-ai-server/
├── app.py                # Streamlit frontend
├── requirements.txt      # Python deps
├── README.md             # You are here

📢 Credits

Built with ❤️ by Raghul M

Inspired by a simple idea: "What if I could run AI server without the cloud?"

About

A A lightweight AI server using Ollama, Cloudflare Tunnel, and Streamlit on old laptop.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages