Skip to main content

⚡ litrun

CI Matrix Release & Distribution PyPI version GitHub Pages License: MIT Supported SoCs GitHub release

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.

litrun terminal demo


🚀 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:

  1. In Home Assistant, open Settings → Add-ons → Add-on Store → Repositories.
  2. Add: https://github.com/assassinaj602/litrun
  3. Click Install on litrun Local AI Runtime.
  4. 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.


🎙️ Edge Audio Perception & Voice-to-Action (litrun hear)

Capture voice instructions directly from USB microphones, I2S mic arrays, or WAV audio files and pipe speech recognition into autonomous edge actions:

# Direct transcription:
litrun hear sample.wav

# Live mic capture piped straight into autonomous GPIO execution:
litrun hear --mic --pipe-run --tools
litrun hear: "Turn on the cooling fan connected to GPIO pin 18"
→ Routing transcription to litrun autonomous engine...
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}
litrun: I have activated the cooling fan on GPIO pin 18.

🤖 ROS 2 (Robot Operating System) Integration

Deploy deterministic on-device LLM reasoning and velocity commands onto ROS 2 robotics platforms (TurtleBot 4, autonomous rovers):

# Launch native litrun ROS 2 node
ros2 launch litrun_ros litrun_agent.launch.py

The node subscribes to /robot/task_query (std_msgs/String), evaluates tasks through litrun with strict GBNF JSON schemas, and publishes decisions to /robot/action_decision and /cmd_vel (geometry_msgs/Twist).

See the complete ROS 2 Package Guide.


📊 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.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litrun 0.4.0
File Size Uploaded Provenance Actions
litrun-0.4.0.tar.gz 62.0 kB Without provenance Details for litrun-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for litrun 0.4.0
File Interpreter ABI Platform Actions
litrun-0.4.0-py3-none-any.whl Python 3 none any Details for litrun-0.4.0-py3-none-any.whl

Total release size: 127.1 kB

Release files / litrun-0.4.0.tar.gz

Download URL litrun-0.4.0.tar.gz
Size 62.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed5ab522505a2dd29a329e980d56587d9313bee543b7170840b83e8379370b17
BLAKE2b-256 checksum
How to use checksums
74e5a5b0837ed1e570ad1f2d08ef925619639a9ec7373860f9d1d60660fb6f3e
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.4.0-py3-none-any.whl

Download URL litrun-0.4.0-py3-none-any.whl
Size 65.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8efe7b28f18da844bea7b51e348eeef15c637767690c358198310b55ec78348c
BLAKE2b-256 checksum
How to use checksums
a65b499bf931c180865270c19a51a5fd23b445bbc57ee6dff7ba1d93975e014b
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.4.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page