|
| 1 | +# Layla Server |
| 2 | + |
| 3 | +**Run powerful LLM models on your PC. Chat from anywhere on your phone.** |
| 4 | + |
| 5 | +Layla Server is a lightweight wrapper around `llama-server` (or any OpenAI-compatible inference engine) that exposes your local LLM over WebRTC — so you can connect to it from anywhere, just by scanning a QR code with the [Layla app](https://www.layla-network.ai). |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Why Layla Server? |
| 10 | + |
| 11 | +Your PC has the horsepower to run large, capable models. Your phone has the convenience. Layla Server bridges the two — no port forwarding, no static IP, no cloud subscription required. |
| 12 | + |
| 13 | +- ✅ **One QR code** to connect your phone to your PC's LLM |
| 14 | +- ✅ **Works anywhere** — WebRTC punches through NAT and firewalls |
| 15 | +- ✅ **Long-lived sessions** — polling-based signalling keeps the server up indefinitely |
| 16 | +- ✅ **One-click installer** — ships with a bundled `llama-server` snapshot, no setup needed |
| 17 | +- ✅ **BYOM** — bring your own GGUF models |
| 18 | +- ✅ **Swap backends** — switch to any OpenAI-compatible inference engine in settings |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## How It Works |
| 23 | + |
| 24 | +``` |
| 25 | +┌─────────────────────────────┐ WebRTC ┌──────────────┐ |
| 26 | +│ Your PC │ ◄──────────────────► │ Layla App │ |
| 27 | +│ │ │ (iPhone / │ |
| 28 | +│ llama-server ←→ Layla │ QR code │ Android) │ |
| 29 | +│ (or any OpenAI-compat API) │ └──────────────┘ |
| 30 | +└─────────────────────────────┘ |
| 31 | +``` |
| 32 | + |
| 33 | +1. Layla Server starts `llama-server` (or connects to your preferred backend) |
| 34 | +2. It generates a QR code encoding the WebRTC connection offer |
| 35 | +3. Scan the QR code with the Layla app — a peer-to-peer connection is established |
| 36 | +4. All OpenAI-compatible HTTP calls from the app are proxied over WebRTC to your local model |
| 37 | +5. Reconnect any time by scanning a new QR code — the server stays alive via polling-based signalling |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## Quick Start |
| 42 | + |
| 43 | +### Option 1 — One-Click Install (Recommended for non-technical users) |
| 44 | + |
| 45 | +Download the latest release for your platform from the [Releases page](https://github.com/your-org/layla-server/releases). |
| 46 | + |
| 47 | +Layla Server ships with a bundled `llama-server` snapshot — no separate installation required (you can easily swap it out with newer versions or even different servers). |
| 48 | + |
| 49 | +1. Download and unzip the release |
| 50 | +2. Drop your `.gguf` model file into the `models/` folder |
| 51 | +3. Launch `layla-server` |
| 52 | +4. Open the Layla app on your phone and scan the QR code |
| 53 | + |
| 54 | +That's it. You're now chatting with your local model from your phone. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +### Option 2 — From Source |
| 59 | + |
| 60 | +**Prerequisites:** Node.js 18+ (or your runtime of choice) |
| 61 | + |
| 62 | +```bash |
| 63 | +git clone https://github.com/your-org/Layla-Server.git |
| 64 | +cd Layla-Server |
| 65 | +npm install |
| 66 | +npm start |
| 67 | +``` |
| 68 | + |
| 69 | +Build an `.exe` for Windows: |
| 70 | + |
| 71 | +```bash |
| 72 | +npm run dist |
| 73 | +``` |
| 74 | +--- |
| 75 | + |
| 76 | +## Configuration |
| 77 | + |
| 78 | +All settings are available in the **Settings** panel of the Layla Server UI. |
| 79 | + |
| 80 | +| Setting | Description | |
| 81 | +|---|---| |
| 82 | +| **Model path** | Path to your `.gguf` model file | |
| 83 | +| **Inference backend** | URL of any OpenAI-compatible server (default: bundled `llama-server`) | |
| 84 | +| **Additional Cmd Args** | Additional command-line arguments to pass to the server executable | |
| 85 | + |
| 86 | +### Using a Custom Backend |
| 87 | + |
| 88 | +Layla Server proxies to any OpenAI-compatible endpoint. To use a different inference engine (LM Studio, Ollama, vLLM, etc.), just point the backend URL to it in Settings — no other changes needed. |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## Using Your Own Models |
| 93 | + |
| 94 | +Layla Server supports any model in **GGUF format**. |
| 95 | + |
| 96 | +1. Download a GGUF model (e.g. from [Hugging Face](https://huggingface.co/models?library=gguf)) |
| 97 | +2. Select your model in the settings page |
| 98 | +3. Restart the server — the new model is loaded automatically |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## Connecting the Layla App |
| 103 | + |
| 104 | +1. Launch Layla Server on your PC |
| 105 | +2. A QR code will appear in the UI |
| 106 | +3. Open the **Layla app** on your phone |
| 107 | +4. Tap **Connect** → **Scan QR code** |
| 108 | +5. Point your camera at the code — connection is established instantly |
| 109 | + |
| 110 | +The server uses **polling-based WebRTC signalling**, so it stays alive and connectable for as long as it's running. You can close the app, leave for hours, and reconnect whenever you like (no need to scan QR code again). |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Architecture Notes |
| 115 | + |
| 116 | +- **WebRTC transport** — peer-to-peer data channel; traffic goes directly between your devices once connected |
| 117 | +- **Polling signalling** — no persistent WebSocket required; the server polls for new connection offers at a configurable interval, making it robust for long-running sessions |
| 118 | +- **OpenAI-compatible proxy** — the WebRTC channel transparently forwards HTTP requests and responses, so the Layla app doesn't need to know anything about the underlying transport |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Related |
| 123 | + |
| 124 | +- [Layla App](https://www.layla-network.ai) — the offline LLM mobile client |
| 125 | +- [llama.cpp](https://github.com/ggml-org/llama.cpp) — the inference engine powering the bundled backend |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## License |
| 130 | + |
| 131 | +MIT © Layla Network Pty Ltd |
0 commit comments