⚡ litrun
Deploy any LLM to any embedded Linux device in one command.
A lightweight, universal open-source runtime that eliminates hardware fragmentation for on-device AI across Raspberry Pi, Orange Pi, industrial SoCs, and ARM64 / RISC-V edge boards.
🚀 Quickstart: The One Working Moment
1. Instant POSIX Bootstrap (No toolchains, no cmake)
curl -sSL https://raw.githubusercontent.com/assassinaj602/litrun/main/scripts/install.sh | sh
Or via pip:
pip install litrun
2. Inspect Hardware Vector Capabilities (<5ms)
litrun inspect
3. Run Your First Model With Zero Guesswork
litrun run qwen2.5-0.5b
→ Detected: Raspberry Pi 5 Model B (BCM2712 Cortex-A76, 8192 MB RAM)
→ Selected: qwen2.5-0.5b-Q4_K_M (optimal RAM envelope: 900MB required / 6800MB free)
→ Binary: pulling precompiled ARM64 a76+dotprod build... done [cached]
→ Model: streaming weights from HuggingFace (397MB)... done
→ Warmup complete. Running at 14.2 tokens/sec on 4 threads. Type to interact.
> Hello litrun! How do you prevent out-of-memory crashes on embedded devices?
litrun: I integrate a dedicated C resource governor that inspects Linux memory
cgroups and /proc/meminfo before model allocation, preventing kernel OOM-killer panics.
🧠 Why Litrun Exists
| The Amateur Edge AI Struggle | The Litrun Way |
|---|---|
| 45-minute on-device compilation on Pi 4 that thermal throttles and crashes during linking. | Instant prebuilt binaries cross-compiled per microarchitecture (Cortex-A72 NEON, Cortex-A76 DotProd). |
| Quantization guesswork: Devs guess between Q4_K_M, Q5_K_S, IQ3_XS without knowing if RAM + KV cache fits. | Hardware-aware envelope: Evaluates free RAM + KV cache before launch, picking optimal accuracy safely. |
| Silent kernel panics: Linux OOM-killer randomly terminates services or hangs the board. | Active Resource Governor: Hard memory ceilings and dynamic thermal throttling. |
| Disjoint vendor APIs: llama.cpp, ONNX Runtime, and RKNN share zero API commonality. | Unified Interface: One CLI, Python SDK (from litrun import Model), and drop-in OpenAI REST API. |
🏛️ System Architecture
Litrun is architected in 5 decoupled layers:
┌────────────────────────────────────────────────────────┐
│ LAYER 1: User Surface (CLI, Python SDK, REST Server) │
│ litrun run/pull/list/inspect/serve • from litrun import Model │
└──────────────────────────┬─────────────────────────────┘
│
┌──────────────────────────▼─────────────────────────────┐
│ LAYER 2: Orchestration & Active Resource Governor │
│ RAM Safety Ceiling (85%) • Cgroup v1/v2 • Thermal Monitor│
└──────────────────────────┬─────────────────────────────┘
│
┌──────────────────────────▼─────────────────────────────┐
│ LAYER 3: Hardware Abstraction Native Engine (Pure C99) │
│ Devicetree • Aux Vector (NEON, DotProd, i8mm) • <5ms │
└──────────────────────────┬─────────────────────────────┘
│
┌──────────────────────────▼─────────────────────────────┐
│ LAYER 4: Pluggable Inference Backends │
│ llama.cpp (ARM DotProd) • RKNN NPU • ONNX Runtime │
└──────────────────────────┬─────────────────────────────┘
│
┌──────────────────────────▼─────────────────────────────┐
│ LAYER 5: Distributed Metadata Registries (Flat YAML) │
│ models.yaml • hardware.yaml • binaries.yaml (GitHub CDN) │
└────────────────────────────────────────────────────────┘
💻 Python SDK Usage
from litrun import Model, probe_hardware, poll_governor
# 1. Inspect hardware and active memory governor
hw = probe_hardware()
print(f"Board: {hw.board_name} | Profile: {hw.profile_id}")
print(f"Vector Acceleration: NEON={hw.has_neon}, DotProd={hw.has_dotprod}")
# 2. Automatically resolves hardware, checks RAM envelope, pulls weights
model = Model.load("qwen2.5-0.5b")
# 3. Stream tokens in real time
for chunk in model.stream("Summarize industrial sensor telemetry:"):
print(chunk, end="", flush=True)
# 4. Or launch the local OpenAI-compatible REST server
# model.serve(host="0.0.0.0", port=8080)
🌐 OpenAI-Compatible REST Server
Drop Litrun directly into LangChain, LlamaIndex, AutoGen, or web frontends:
litrun serve --port 8080 qwen2.5-0.5b
Send standard OpenAI completions:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-0.5b",
"messages": [{"role": "user", "content": "Explain edge computing in one sentence."}],
"stream": true
}'
Query live hardware and thermal telemetry via REST:
curl http://localhost:8080/v1/hardware
📐 Deterministic JSON Mode & GBNF Schema Enforcement
Small models (0.5B – 1.5B) often hallucinate syntax errors when asked for JSON. Litrun compiles JSON schemas directly into GGML BNF (GBNF) grammars, forcing output tokens to adhere strictly to your schema:
Via CLI:
# Standard valid JSON:
litrun run qwen2.5-0.5b --json -p "Extract sensor telemetry: temperature is 24.2C and status is nominal"
# Or with strict schema:
litrun run qwen2.5-0.5b --schema '{"type":"object","properties":{"temp":{"type":"number"},"status":{"type":"string"}},"required":["temp","status"]}'
Via OpenAI REST API:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-0.5b",
"messages": [{"role": "user", "content": "Return room telemetry"}],
"response_format": {"type": "json_object"}
}'
👁️ Vision-Language Perception (litrun see)
Execute ultra-compact Vision-Language Models (VLMs) directly against local image files or live Linux V4L2 camera sensors:
# Query any image file:
litrun see frame.jpg -p "What objects are on the table?"
# Inspect live camera feed on /dev/video0:
litrun see /dev/video0 -p "Is anyone approaching the security gate?"
Supported out-of-the-box:
- SmolVLM 256M Instruct (only ~240MB RAM required — runs smoothly on 2GB Raspberry Pi 4).
- Moondream2 1.8B (high-accuracy scene reasoning).
🔌 Autonomous Edge GPIO & Hardware Tool Calling
Enable small edge models to autonomously actuate physical hardware (fans, relays, motors, buzzers) and read digital sensors or thermal telemetry via direct Linux sysfs:
litrun run --tools -p "The ambient temperature is high, turn on the cooling fan connected to GPIO pin 18"
litrun: {"tool": "gpio_write", "parameters": {"pin": 18, "value": 1}}
⚡ Hardware Action: Executing gpio_write({"pin": 18, "value": 1})
✓ Hardware Result: {"success": true, "pin": 18, "state": 1, "message": "GPIO pin 18 driven to HIGH"}
litrun: I have activated the cooling fan on GPIO pin 18 and confirmed the hardware state is HIGH.
Built-in tools:
gpio_write(pin, value): Drives GPIO pin HIGH (1) or LOW (0).gpio_read(pin): Reads digital state from buttons or PIR sensors.get_hardware_telemetry(): Reads host SoC CPU temperature, 1m load average, and thermal throttling state.
🏠 Home Assistant 1-Click Supervisor Add-on
Run litrun as an official add-on directly inside Home Assistant OS:
- In Home Assistant, open Settings → Add-ons → Add-on Store → Repositories.
- Add:
https://github.com/assassinaj602/litrun - Click Install on litrun Local AI Runtime.
- Point your Home Assistant Assist voice pipeline or OpenAI Conversation integration to
http://localhost:8080/v1.
See the complete Home Assistant Integration Guide & Docker Compose. Try the interactive Edge Memory Calculator to test hardware envelopes before deployment.
📊 Hardware Support Matrix
| Board / SBC | SoC Architecture | Vector Extensions / NPU | Default Speed | Phase |
|---|---|---|---|---|
| Raspberry Pi 5 | BCM2712 (Cortex-A76) | ARM NEON + DotProd (ASIMDDP) | 14.2 tok/s | Phase 1 (GA) |
| Raspberry Pi 4 Model B | BCM2711 (Cortex-A72) | ARM NEON (ASIMD) | 8.2 tok/s | Phase 1 (GA) |
| Raspberry Pi 3 / Zero 2 W | BCM2837 (Cortex-A53) | ARM NEON Baseline | 14.5 tok/s (135M) | Phase 1 (GA) |
| Orange Pi 5 / 5 Plus | Rockchip RK3588 | 6 TOPS NPU (RKNN) + A76/A55 | 18.5 tok/s | Phase 2 |
| NVIDIA Jetson Orin Nano | Tegra Orin (Cortex-A78AE) | Ampere GPU + NVDLA | 28.0 tok/s | Phase 2 |
| Generic x86_64 Edge Host | Intel Core / AMD Ryzen | AVX2 + FMA | 32.0 tok/s | Phase 1 (GA) |
🛠️ Building & Testing from Source
# Clone the repository
git clone https://github.com/assassinaj602/litrun.git
cd litrun
# Build C Native Core and Shared Library
make all
# Run complete test suite (C99 unit tests + Python test suite)
make test
# Install locally in editable development mode
make install-dev
📄 License
Litrun is 100% open-source software licensed under the MIT License. Built with ❤️ for the embedded Linux and robotics community.
Metadata
Release files for litrun 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| litrun-0.3.0.tar.gz | 59.1 kB | Without provenance | Details for litrun-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| litrun-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for litrun-0.3.0-py3-none-any.whl |
Total release size: 121.3 kB
Release files / litrun-0.3.0.tar.gz
| Download URL | litrun-0.3.0.tar.gz |
|---|---|
| Size | 59.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e987efdde4a767459fddcf1142003afa156c2cd953ae03d5674e188b186a2e6
|
|
BLAKE2b-256 checksum How to use checksums |
d5900eb0d77a16fefbb73fad0f64ce80d8a5603c0776a480973625a141a7f0aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0rc3
|
Release files / litrun-0.3.0-py3-none-any.whl
| Download URL | litrun-0.3.0-py3-none-any.whl |
|---|---|
| Size | 62.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
535166da174dd08164557775fd669f257f84477a6db5b73b440abea13f1a7afb
|
|
BLAKE2b-256 checksum How to use checksums |
7d0af79295c05b52971f119e0d36bc877efdbd3f1403dcfcefebe0369b9e0d8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0rc3
|
Security for litrun 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.