minillama 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. minillama-0.2.1/LICENSE +21 -0
  2. minillama-0.2.1/PKG-INFO +196 -0
  3. minillama-0.2.1/README.md +179 -0
  4. minillama-0.2.1/minillama/__init__.py +2 -0
  5. minillama-0.2.1/minillama/__main__.py +4 -0
  6. minillama-0.2.1/minillama/assets/apple-touch-icon.png +0 -0
  7. minillama-0.2.1/minillama/assets/dashboard.html +8827 -0
  8. minillama-0.2.1/minillama/assets/icon-192.png +0 -0
  9. minillama-0.2.1/minillama/assets/icon-512.png +0 -0
  10. minillama-0.2.1/minillama/assets/icon-maskable-512.png +0 -0
  11. minillama-0.2.1/minillama/assets/manifest.json +67 -0
  12. minillama-0.2.1/minillama/assets/minillama.ico +0 -0
  13. minillama-0.2.1/minillama/assets/minillama.png +0 -0
  14. minillama-0.2.1/minillama/assets/sw.js +109 -0
  15. minillama-0.2.1/minillama/autostart.py +127 -0
  16. minillama-0.2.1/minillama/boot.py +218 -0
  17. minillama-0.2.1/minillama/cli.py +1757 -0
  18. minillama-0.2.1/minillama/comfy.py +1087 -0
  19. minillama-0.2.1/minillama/config.py +309 -0
  20. minillama-0.2.1/minillama/daemon.py +218 -0
  21. minillama-0.2.1/minillama/desktop_app.py +137 -0
  22. minillama-0.2.1/minillama/engine.py +563 -0
  23. minillama-0.2.1/minillama/engines.py +1400 -0
  24. minillama-0.2.1/minillama/extensions.py +484 -0
  25. minillama-0.2.1/minillama/hw.py +295 -0
  26. minillama-0.2.1/minillama/lan.py +996 -0
  27. minillama-0.2.1/minillama/layout.py +47 -0
  28. minillama-0.2.1/minillama/logs.py +180 -0
  29. minillama-0.2.1/minillama/loopgpu.py +138 -0
  30. minillama-0.2.1/minillama/mcp_client.py +406 -0
  31. minillama-0.2.1/minillama/media.py +1144 -0
  32. minillama-0.2.1/minillama/media_puller.py +791 -0
  33. minillama-0.2.1/minillama/models.py +970 -0
  34. minillama-0.2.1/minillama/modules.py +865 -0
  35. minillama-0.2.1/minillama/mtp.py +149 -0
  36. minillama-0.2.1/minillama/net.py +336 -0
  37. minillama-0.2.1/minillama/performance.py +348 -0
  38. minillama-0.2.1/minillama/procs.py +96 -0
  39. minillama-0.2.1/minillama/prompts.py +812 -0
  40. minillama-0.2.1/minillama/providers.py +664 -0
  41. minillama-0.2.1/minillama/puller.py +190 -0
  42. minillama-0.2.1/minillama/recommendations.py +782 -0
  43. minillama-0.2.1/minillama/sd_convert.py +612 -0
  44. minillama-0.2.1/minillama/selftest.py +291 -0
  45. minillama-0.2.1/minillama/server.py +3820 -0
  46. minillama-0.2.1/minillama/stats.py +140 -0
  47. minillama-0.2.1/minillama/tls.py +227 -0
  48. minillama-0.2.1/minillama/tray.py +486 -0
  49. minillama-0.2.1/minillama/userpath.py +168 -0
  50. minillama-0.2.1/minillama/websearch.py +157 -0
  51. minillama-0.2.1/minillama.egg-info/PKG-INFO +196 -0
  52. minillama-0.2.1/minillama.egg-info/SOURCES.txt +95 -0
  53. minillama-0.2.1/minillama.egg-info/dependency_links.txt +1 -0
  54. minillama-0.2.1/minillama.egg-info/entry_points.txt +2 -0
  55. minillama-0.2.1/minillama.egg-info/requires.txt +7 -0
  56. minillama-0.2.1/minillama.egg-info/top_level.txt +1 -0
  57. minillama-0.2.1/pyproject.toml +36 -0
  58. minillama-0.2.1/setup.cfg +4 -0
  59. minillama-0.2.1/tests/test_autotune.py +128 -0
  60. minillama-0.2.1/tests/test_cli.py +397 -0
  61. minillama-0.2.1/tests/test_cli_tray_new.py +132 -0
  62. minillama-0.2.1/tests/test_dev2_comfy.py +419 -0
  63. minillama-0.2.1/tests/test_dev2_config.py +158 -0
  64. minillama-0.2.1/tests/test_dev2_engine.py +255 -0
  65. minillama-0.2.1/tests/test_dev2_engines.py +718 -0
  66. minillama-0.2.1/tests/test_dev2_hwcache.py +17 -0
  67. minillama-0.2.1/tests/test_dev2_logs.py +100 -0
  68. minillama-0.2.1/tests/test_dev2_logs_live.py +26 -0
  69. minillama-0.2.1/tests/test_dev2_net.py +265 -0
  70. minillama-0.2.1/tests/test_dev2_stats.py +54 -0
  71. minillama-0.2.1/tests/test_dev2_xplat.py +225 -0
  72. minillama-0.2.1/tests/test_dev3_boot_stats.py +137 -0
  73. minillama-0.2.1/tests/test_dev3_cache_rule.py +213 -0
  74. minillama-0.2.1/tests/test_dev3_lan.py +440 -0
  75. minillama-0.2.1/tests/test_dev3_media.py +626 -0
  76. minillama-0.2.1/tests/test_fast_gguf_and_pull.py +147 -0
  77. minillama-0.2.1/tests/test_live.py +272 -0
  78. minillama-0.2.1/tests/test_loopgpu.py +226 -0
  79. minillama-0.2.1/tests/test_models.py +208 -0
  80. minillama-0.2.1/tests/test_modular_app_and_civitai.py +1390 -0
  81. minillama-0.2.1/tests/test_music_and_ui.py +809 -0
  82. minillama-0.2.1/tests/test_performance.py +142 -0
  83. minillama-0.2.1/tests/test_prompts_metadata.py +377 -0
  84. minillama-0.2.1/tests/test_pwa_tls.py +80 -0
  85. minillama-0.2.1/tests/test_server.py +363 -0
  86. minillama-0.2.1/tests/test_speculation_modes.py +51 -0
  87. minillama-0.2.1/tests/test_ui_recovery.py +227 -0
  88. minillama-0.2.1/tests/test_unit_cli.py +226 -0
  89. minillama-0.2.1/tests/test_unit_cli_rm.py +146 -0
  90. minillama-0.2.1/tests/test_unit_daemon.py +121 -0
  91. minillama-0.2.1/tests/test_unit_layout.py +15 -0
  92. minillama-0.2.1/tests/test_unit_models.py +227 -0
  93. minillama-0.2.1/tests/test_unit_net_whitelist.py +202 -0
  94. minillama-0.2.1/tests/test_unit_server.py +267 -0
  95. minillama-0.2.1/tests/test_v1_vibecode_stack.py +197 -0
  96. minillama-0.2.1/tests/test_video_aspect_samplers_llm_gen.py +236 -0
  97. minillama-0.2.1/tests/test_xplat_install.py +129 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MiniLlama Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: minillama
3
+ Version: 0.2.1
4
+ Summary: A private local AI workspace for llama.cpp, ComfyUI media studios, and LAN/PWA access
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: requests>=2.31
10
+ Requires-Dist: Pillow>=10.0
11
+ Requires-Dist: pystray>=0.19
12
+ Requires-Dist: psutil>=5.9
13
+ Requires-Dist: gguf>=0.10
14
+ Requires-Dist: cryptography>=42.0
15
+ Requires-Dist: numpy>=1.26
16
+ Dynamic: license-file
17
+
18
+ # MiniLlama (Python)
19
+
20
+ Private, local-first AI workspace for running GGUF language & vision models (`llama.cpp`), Image / Video / Music studios (`ComfyUI`), fast PC-to-Phone checkpoint conversion, and self-contained on-device Android inference.
21
+
22
+ ---
23
+
24
+ ## Features
25
+
26
+ - **Modern Dark Chat Workspace**: Sleek obsidian & emerald-sapphire web dashboard inspired by ChatGPT and Gemini — collapsible sidebar with instant search and floating `More` menu, centered pill composer with `+` tools popover, streaming responses, stop controls, and responsive phone layout with zero ads or subscription prompts.
27
+ - **First-Start Setup Questionnaire & Live Available-VRAM Model Recommender**:
28
+ - Measures **real-time available (free) VRAM** on your GPU (or available RAM on Android) *before* making any suggestions.
29
+ - Fetches live trending **Hugging Face** models across **LLMs (GGUF)**, **Images**, **Video**, and **Music** that actually fit your current hardware budget.
30
+ - Works for both **PC** and **Phone** targets, with options to skip setup or enter any custom Hugging Face repo / model name manually.
31
+ - **Local LLM & Vision Chat**: OpenAI-compatible (`/v1/*`) and Ollama-compatible (`/api/*`) local API on port `11434`, automatic GGUF metadata inspection, vision `mmproj` pairing, and multi-engine support (`llama.cpp`, `KoboldCpp`, `ik_llama.cpp`).
32
+ - **Image, Video & Music Studios (ComfyUI)**:
33
+ - **Image Studio**: Stable Diffusion (SD 1.5, SDXL, Illustrious, Flux, SD3), LoRAs, img2img, and optional upscaling with Hugging Face & Civitai downloads.
34
+ - **Video Studio**: Local text-to-video and image-to-video workflows (Wan 2.2, LTX-Video).
35
+ - **Music Studio**: Original song generation and audio-to-music covers using YuE2 (with SheetSage2 conditioning) and ACE-Step.
36
+ - **Automatic VRAM Handoff & Persistent Gallery**: Automatically unloads the active LLM before running media jobs (and frees ComfyUI VRAM before loading an LLM) while saving all outputs in a browsable local gallery.
37
+ - **PC-to-Phone Fast LAN Transfer & Streaming Converter**: On-the-fly streaming conversion of `.safetensors` checkpoints to **FP8** (`F8_E4M3`), **4-Bit GGUF (`Q4_0`)**, or **8-Bit GGUF (`Q8_0`)** over LAN with HTTP Range resume.
38
+ - **Self-Contained Android App (`mobile/android/` -> `MiniLlama.apk`)**:
39
+ - Runs GGUF LLMs and Stable Diffusion directly on Android via Vulkan GPU, CPU, Hybrid, or NPU modes.
40
+ - Dynamic **Phone Link** QR & 6-digit code pairing with `.local` mDNS support and rotating LAN tokens.
41
+ - Hardened mobile privacy: anonymous `Mozilla/5.0` headers, reduced WebView User-Agent, and zero device metadata sent to external servers.
42
+ - Built-in **GitHub Releases Self-Updater**: automatically checks `minillama-dev` GitHub Releases, verifies the APK SHA-256 checksum against `SHA256SUMS.txt`, and upgrades in place without needing a PC.
43
+ - **Performance Lab & Auto-Tune**: Live hardware telemetry, multi-GPU layer split and loop-aware tensor placement, safe OOM KV-cache fallbacks (`f16` -> `q8_0` -> `q4_0` without shrinking your context length), speculative decoding, and built-in benchmarking.
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ### Option 1: Install via `pip` (Wheel, GitHub, or PyPI)
50
+
51
+ Because MiniLlama is packaged as a standard Python wheel (`minillama-0.2.1-py3-none-any.whl`), you can install it directly with `pip`:
52
+
53
+ ```bash
54
+ # Directly from PyPI:
55
+ pip install minillama
56
+
57
+ # Or from a downloaded GitHub Release wheel:
58
+ pip install https://github.com/minillama-dev/minillama-py/releases/download/v0.2.1/minillama-0.2.1-py3-none-any.whl
59
+
60
+ # Or straight from the GitHub repository:
61
+ pip install git+https://github.com/minillama-dev/minillama-py.git
62
+ ```
63
+
64
+ After installing via `pip`, download the optimal inference engine for your GPU and launch the app:
65
+
66
+ ```bash
67
+ minillama update # Download the best llama.cpp build for your GPU
68
+ minillama serve # Start daemon + tray icon and open the dashboard
69
+ ```
70
+
71
+ > **Why is the `.whl` only ~900 KB?**
72
+ > A `.whl` file is a Deflate-compressed ZIP archive containing all 38 Python source modules, the full web dashboard, app icons, and package metadata (`entry_points` + `dependencies`). When you run `pip install`, `pip` automatically downloads the required Python libraries (`requests`, `Pillow`, `psutil`, `pystray`, `gguf`, `cryptography`, `numpy`) from PyPI. Heavy OS/GPU-specific runtimes (`llama.cpp`, ComfyUI + PyTorch) and AI model weights are downloaded on demand so the wheel stays tiny and cross-platform.
73
+
74
+ ### Option 2: Modular One-Click Installer (Recommended for Full Setup)
75
+
76
+ Installs an isolated `.venv`, MiniLlama, the best `llama.cpp` GPU build, the native Desktop App wrapper, and **ComfyUI Media Studio** automatically.
77
+
78
+ **Windows:**
79
+ ```powershell
80
+ install.bat
81
+ ```
82
+
83
+ **macOS / Linux:**
84
+ ```bash
85
+ chmod +x install.sh start_minillama.sh minillama.sh
86
+ ./install.sh --add-path
87
+ ```
88
+
89
+ **Or run `install.py` directly on any OS with modular flags:**
90
+ ```bash
91
+ python install.py # Full modular install (Core + llama.cpp + Desktop App + ComfyUI)
92
+ python install.py --interactive # Pick modules interactively
93
+ python install.py --no-comfyui # Skip ComfyUI Media Studio
94
+ python install.py --no-engine # Skip llama.cpp download
95
+ python install.py --no-desktop-app # Skip Desktop App wrapper
96
+ python install.py --port 11500 --autostart --add-path --lan --start
97
+ ```
98
+
99
+ ### Option 3: Portable Archive & Android APK
100
+
101
+ - **Portable Python Zip (`minillama-py-portable.zip`)**: Extract anywhere and run `install.bat` (Windows) or `./install.sh` (macOS/Linux).
102
+ - **Android (`MiniLlama.apk`)**: Transfer or scan the QR code from the dashboard's **Phone Link** tab to install the companion on-device Android app.
103
+
104
+ > Looking for a **zero-Python native C++20 binary** with graphical installers for Windows, macOS, and Linux? See the companion **[minillama-cpp](https://github.com/minillama-dev/minillama-cpp)** repository.
105
+
106
+ ---
107
+
108
+ ## Quick Usage
109
+
110
+ ```bash
111
+ # Launch Desktop App
112
+ start_minillama_app.bat # Windows
113
+ ./start_minillama_app.sh # macOS / Linux
114
+
115
+ # Or start daemon + tray + web dashboard (http://127.0.0.1:11434)
116
+ minillama serve
117
+
118
+ # Pull any GGUF directly from Hugging Face
119
+ minillama pull bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M
120
+
121
+ # Import existing Ollama or LM Studio models (uses hard links — zero extra disk space)
122
+ minillama import ollama
123
+ minillama import lmstudio
124
+ ```
125
+
126
+ ---
127
+
128
+ ## CLI Reference
129
+
130
+ | Command | Description |
131
+ | :--- | :--- |
132
+ | `minillama serve [--no-tray]` | Start the daemon in the foreground (HTTP API, dashboard, and tray icon). |
133
+ | `minillama daemon` | Run the background daemon (used by autostart). |
134
+ | `minillama list` | List all local GGUF models and SD checkpoints. |
135
+ | `minillama pull <user>/<repo>[:<quant>]` | Download a GGUF model (and vision `mmproj` if present) from Hugging Face. |
136
+ | `minillama import ollama \| lmstudio` | Import local models from Ollama or LM Studio via hard links. |
137
+ | `minillama run <model> [prompt] [--ctx N]` | Load a model and open an interactive terminal chat or run a one-shot prompt. |
138
+ | `minillama load <model> [--ctx N]` | Load a model into memory without opening terminal chat. |
139
+ | `minillama unload` | Unload the active model and free VRAM/RAM while keeping the daemon running. |
140
+ | `minillama ps` / `minillama status` | Show daemon health, loaded model, context size, and live GPU/VRAM usage. |
141
+ | `minillama endpoints` | Display OpenAI- and Ollama-compatible local API URLs. |
142
+ | `minillama image "<prompt>" [--image file] [--upscale]` | Generate or edit an image via ComfyUI (`--aspect`, `--lora`, `--steps`, `--cfg`). |
143
+ | `minillama video "<prompt>" [--image file] [--res 720\|1080]` | Generate a text-to-video or image-to-video clip via ComfyUI. |
144
+ | `minillama music "<style>" [--lyrics ...] [--audio file]` | Generate a song or YuE2 music cover locally via ComfyUI. |
145
+ | `minillama gallery [list \| rm <id>]` | Browse or delete saved image, video, and music outputs. |
146
+ | `minillama lan [status \| on \| off \| rotate \| rotation \| code]` | Manage Phone Link LAN access, token rotation, `.local` URL, and 6-digit pairing codes. |
147
+ | `minillama engine [list \| set \| update <id\|all> \| auto-update \| tune]` | Manage `llama.cpp`, `KoboldCpp`, `ik_llama.cpp`, and `ComfyUI`. |
148
+ | `minillama update` | Install the latest verified `llama.cpp` build (retains the newest two builds). |
149
+ | `minillama config [show \| get \| set \| reset]` | View or update runtime profiles, KV cache, speculation, threads, batch size, and ports. |
150
+ | `minillama net list \| allow \| deny \| firewall` | Inspect or edit the outbound host whitelist. |
151
+ | `minillama autostart on \| off` | Toggle daemon startup at OS login (never auto-loads a model). |
152
+ | `minillama rm <model> [--trash]` | Delete a model (or move to `_trash`). |
153
+ | `minillama stats [reset]` | View or reset peak tokens/second metrics. |
154
+ | `minillama restart [--daemon]` | Reload the active model or restart the daemon. |
155
+ | `minillama stop` / `minillama kill` | Gracefully stop the daemon or terminate tracked MiniLlama processes. |
156
+ | `minillama selftest` | Run isolated self-tests for Phone Link, VRAM handoff, and media endpoints. |
157
+
158
+ ---
159
+
160
+ ## HTTP API
161
+
162
+ See **[API.md](API.md)** for full documentation of all OpenAI-compatible (`/v1/*`), Ollama-compatible (`/api/*`), Media/Gallery (`/api/media/*`), Recommender/Control/Updater (`/minillama/*`), and LAN Pairing endpoints.
163
+
164
+ ---
165
+
166
+ ## Privacy, Memory & Architecture
167
+
168
+ - **100% Local Inference**: Prompts, images, audio, and videos are processed strictly on your hardware.
169
+ - **Zero Device Telemetry**: Trending model recommendations query Hugging Face with generic anonymous headers (`Mozilla/5.0`), never sending hardware IDs, phone model strings, or personal paths.
170
+ - **Strict Outbound Whitelist**: Outbound downloads go through `minillama/net.py`, enforcing an allowlist (`*.huggingface.co`, `*.hf.co`, `*.github.com`, `*.githubusercontent.com`), manual redirect validation, cross-host credential stripping, and SHA-256 verification.
171
+ - **Loopback by Default**: Binds to `127.0.0.1` until you explicitly enable **Phone Link (LAN mode)** with rotating access tokens and short-lived 6-digit pairing codes.
172
+ - **Exact GGUF Context & Safe OOM Fallbacks**: Uses the model's true GGUF `context_length` by default without silently shrinking it, stepping down KV cache precision (`f16` -> `q8_0` -> `q4_0`) on OOM.
173
+ - **Standard Data Locations** (override via `MINILLAMA_HOME`):
174
+ - **Windows**: `%APPDATA%\MiniLlama` (config) & `%LOCALAPPDATA%\MiniLlama` (engines, models, logs)
175
+ - **macOS**: `~/Library/Application Support/MiniLlama`
176
+ - **Linux**: `$XDG_CONFIG_HOME/minillama` & `$XDG_DATA_HOME/minillama`
177
+
178
+ ---
179
+
180
+ ## Building the Wheel & Publishing to PyPI
181
+
182
+ ```bash
183
+ pip install build twine
184
+ python -m build --wheel # Creates dist/minillama-0.2.0-py3-none-any.whl
185
+ twine upload dist/*.whl # Publish to PyPI so anyone can run: pip install minillama
186
+ ```
187
+
188
+ ## Running Tests
189
+
190
+ ```bash
191
+ pytest -q
192
+ ```
193
+
194
+ ## License
195
+
196
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,179 @@
1
+ # MiniLlama (Python)
2
+
3
+ Private, local-first AI workspace for running GGUF language & vision models (`llama.cpp`), Image / Video / Music studios (`ComfyUI`), fast PC-to-Phone checkpoint conversion, and self-contained on-device Android inference.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - **Modern Dark Chat Workspace**: Sleek obsidian & emerald-sapphire web dashboard inspired by ChatGPT and Gemini — collapsible sidebar with instant search and floating `More` menu, centered pill composer with `+` tools popover, streaming responses, stop controls, and responsive phone layout with zero ads or subscription prompts.
10
+ - **First-Start Setup Questionnaire & Live Available-VRAM Model Recommender**:
11
+ - Measures **real-time available (free) VRAM** on your GPU (or available RAM on Android) *before* making any suggestions.
12
+ - Fetches live trending **Hugging Face** models across **LLMs (GGUF)**, **Images**, **Video**, and **Music** that actually fit your current hardware budget.
13
+ - Works for both **PC** and **Phone** targets, with options to skip setup or enter any custom Hugging Face repo / model name manually.
14
+ - **Local LLM & Vision Chat**: OpenAI-compatible (`/v1/*`) and Ollama-compatible (`/api/*`) local API on port `11434`, automatic GGUF metadata inspection, vision `mmproj` pairing, and multi-engine support (`llama.cpp`, `KoboldCpp`, `ik_llama.cpp`).
15
+ - **Image, Video & Music Studios (ComfyUI)**:
16
+ - **Image Studio**: Stable Diffusion (SD 1.5, SDXL, Illustrious, Flux, SD3), LoRAs, img2img, and optional upscaling with Hugging Face & Civitai downloads.
17
+ - **Video Studio**: Local text-to-video and image-to-video workflows (Wan 2.2, LTX-Video).
18
+ - **Music Studio**: Original song generation and audio-to-music covers using YuE2 (with SheetSage2 conditioning) and ACE-Step.
19
+ - **Automatic VRAM Handoff & Persistent Gallery**: Automatically unloads the active LLM before running media jobs (and frees ComfyUI VRAM before loading an LLM) while saving all outputs in a browsable local gallery.
20
+ - **PC-to-Phone Fast LAN Transfer & Streaming Converter**: On-the-fly streaming conversion of `.safetensors` checkpoints to **FP8** (`F8_E4M3`), **4-Bit GGUF (`Q4_0`)**, or **8-Bit GGUF (`Q8_0`)** over LAN with HTTP Range resume.
21
+ - **Self-Contained Android App (`mobile/android/` -> `MiniLlama.apk`)**:
22
+ - Runs GGUF LLMs and Stable Diffusion directly on Android via Vulkan GPU, CPU, Hybrid, or NPU modes.
23
+ - Dynamic **Phone Link** QR & 6-digit code pairing with `.local` mDNS support and rotating LAN tokens.
24
+ - Hardened mobile privacy: anonymous `Mozilla/5.0` headers, reduced WebView User-Agent, and zero device metadata sent to external servers.
25
+ - Built-in **GitHub Releases Self-Updater**: automatically checks `minillama-dev` GitHub Releases, verifies the APK SHA-256 checksum against `SHA256SUMS.txt`, and upgrades in place without needing a PC.
26
+ - **Performance Lab & Auto-Tune**: Live hardware telemetry, multi-GPU layer split and loop-aware tensor placement, safe OOM KV-cache fallbacks (`f16` -> `q8_0` -> `q4_0` without shrinking your context length), speculative decoding, and built-in benchmarking.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ ### Option 1: Install via `pip` (Wheel, GitHub, or PyPI)
33
+
34
+ Because MiniLlama is packaged as a standard Python wheel (`minillama-0.2.1-py3-none-any.whl`), you can install it directly with `pip`:
35
+
36
+ ```bash
37
+ # Directly from PyPI:
38
+ pip install minillama
39
+
40
+ # Or from a downloaded GitHub Release wheel:
41
+ pip install https://github.com/minillama-dev/minillama-py/releases/download/v0.2.1/minillama-0.2.1-py3-none-any.whl
42
+
43
+ # Or straight from the GitHub repository:
44
+ pip install git+https://github.com/minillama-dev/minillama-py.git
45
+ ```
46
+
47
+ After installing via `pip`, download the optimal inference engine for your GPU and launch the app:
48
+
49
+ ```bash
50
+ minillama update # Download the best llama.cpp build for your GPU
51
+ minillama serve # Start daemon + tray icon and open the dashboard
52
+ ```
53
+
54
+ > **Why is the `.whl` only ~900 KB?**
55
+ > A `.whl` file is a Deflate-compressed ZIP archive containing all 38 Python source modules, the full web dashboard, app icons, and package metadata (`entry_points` + `dependencies`). When you run `pip install`, `pip` automatically downloads the required Python libraries (`requests`, `Pillow`, `psutil`, `pystray`, `gguf`, `cryptography`, `numpy`) from PyPI. Heavy OS/GPU-specific runtimes (`llama.cpp`, ComfyUI + PyTorch) and AI model weights are downloaded on demand so the wheel stays tiny and cross-platform.
56
+
57
+ ### Option 2: Modular One-Click Installer (Recommended for Full Setup)
58
+
59
+ Installs an isolated `.venv`, MiniLlama, the best `llama.cpp` GPU build, the native Desktop App wrapper, and **ComfyUI Media Studio** automatically.
60
+
61
+ **Windows:**
62
+ ```powershell
63
+ install.bat
64
+ ```
65
+
66
+ **macOS / Linux:**
67
+ ```bash
68
+ chmod +x install.sh start_minillama.sh minillama.sh
69
+ ./install.sh --add-path
70
+ ```
71
+
72
+ **Or run `install.py` directly on any OS with modular flags:**
73
+ ```bash
74
+ python install.py # Full modular install (Core + llama.cpp + Desktop App + ComfyUI)
75
+ python install.py --interactive # Pick modules interactively
76
+ python install.py --no-comfyui # Skip ComfyUI Media Studio
77
+ python install.py --no-engine # Skip llama.cpp download
78
+ python install.py --no-desktop-app # Skip Desktop App wrapper
79
+ python install.py --port 11500 --autostart --add-path --lan --start
80
+ ```
81
+
82
+ ### Option 3: Portable Archive & Android APK
83
+
84
+ - **Portable Python Zip (`minillama-py-portable.zip`)**: Extract anywhere and run `install.bat` (Windows) or `./install.sh` (macOS/Linux).
85
+ - **Android (`MiniLlama.apk`)**: Transfer or scan the QR code from the dashboard's **Phone Link** tab to install the companion on-device Android app.
86
+
87
+ > Looking for a **zero-Python native C++20 binary** with graphical installers for Windows, macOS, and Linux? See the companion **[minillama-cpp](https://github.com/minillama-dev/minillama-cpp)** repository.
88
+
89
+ ---
90
+
91
+ ## Quick Usage
92
+
93
+ ```bash
94
+ # Launch Desktop App
95
+ start_minillama_app.bat # Windows
96
+ ./start_minillama_app.sh # macOS / Linux
97
+
98
+ # Or start daemon + tray + web dashboard (http://127.0.0.1:11434)
99
+ minillama serve
100
+
101
+ # Pull any GGUF directly from Hugging Face
102
+ minillama pull bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M
103
+
104
+ # Import existing Ollama or LM Studio models (uses hard links — zero extra disk space)
105
+ minillama import ollama
106
+ minillama import lmstudio
107
+ ```
108
+
109
+ ---
110
+
111
+ ## CLI Reference
112
+
113
+ | Command | Description |
114
+ | :--- | :--- |
115
+ | `minillama serve [--no-tray]` | Start the daemon in the foreground (HTTP API, dashboard, and tray icon). |
116
+ | `minillama daemon` | Run the background daemon (used by autostart). |
117
+ | `minillama list` | List all local GGUF models and SD checkpoints. |
118
+ | `minillama pull <user>/<repo>[:<quant>]` | Download a GGUF model (and vision `mmproj` if present) from Hugging Face. |
119
+ | `minillama import ollama \| lmstudio` | Import local models from Ollama or LM Studio via hard links. |
120
+ | `minillama run <model> [prompt] [--ctx N]` | Load a model and open an interactive terminal chat or run a one-shot prompt. |
121
+ | `minillama load <model> [--ctx N]` | Load a model into memory without opening terminal chat. |
122
+ | `minillama unload` | Unload the active model and free VRAM/RAM while keeping the daemon running. |
123
+ | `minillama ps` / `minillama status` | Show daemon health, loaded model, context size, and live GPU/VRAM usage. |
124
+ | `minillama endpoints` | Display OpenAI- and Ollama-compatible local API URLs. |
125
+ | `minillama image "<prompt>" [--image file] [--upscale]` | Generate or edit an image via ComfyUI (`--aspect`, `--lora`, `--steps`, `--cfg`). |
126
+ | `minillama video "<prompt>" [--image file] [--res 720\|1080]` | Generate a text-to-video or image-to-video clip via ComfyUI. |
127
+ | `minillama music "<style>" [--lyrics ...] [--audio file]` | Generate a song or YuE2 music cover locally via ComfyUI. |
128
+ | `minillama gallery [list \| rm <id>]` | Browse or delete saved image, video, and music outputs. |
129
+ | `minillama lan [status \| on \| off \| rotate \| rotation \| code]` | Manage Phone Link LAN access, token rotation, `.local` URL, and 6-digit pairing codes. |
130
+ | `minillama engine [list \| set \| update <id\|all> \| auto-update \| tune]` | Manage `llama.cpp`, `KoboldCpp`, `ik_llama.cpp`, and `ComfyUI`. |
131
+ | `minillama update` | Install the latest verified `llama.cpp` build (retains the newest two builds). |
132
+ | `minillama config [show \| get \| set \| reset]` | View or update runtime profiles, KV cache, speculation, threads, batch size, and ports. |
133
+ | `minillama net list \| allow \| deny \| firewall` | Inspect or edit the outbound host whitelist. |
134
+ | `minillama autostart on \| off` | Toggle daemon startup at OS login (never auto-loads a model). |
135
+ | `minillama rm <model> [--trash]` | Delete a model (or move to `_trash`). |
136
+ | `minillama stats [reset]` | View or reset peak tokens/second metrics. |
137
+ | `minillama restart [--daemon]` | Reload the active model or restart the daemon. |
138
+ | `minillama stop` / `minillama kill` | Gracefully stop the daemon or terminate tracked MiniLlama processes. |
139
+ | `minillama selftest` | Run isolated self-tests for Phone Link, VRAM handoff, and media endpoints. |
140
+
141
+ ---
142
+
143
+ ## HTTP API
144
+
145
+ See **[API.md](API.md)** for full documentation of all OpenAI-compatible (`/v1/*`), Ollama-compatible (`/api/*`), Media/Gallery (`/api/media/*`), Recommender/Control/Updater (`/minillama/*`), and LAN Pairing endpoints.
146
+
147
+ ---
148
+
149
+ ## Privacy, Memory & Architecture
150
+
151
+ - **100% Local Inference**: Prompts, images, audio, and videos are processed strictly on your hardware.
152
+ - **Zero Device Telemetry**: Trending model recommendations query Hugging Face with generic anonymous headers (`Mozilla/5.0`), never sending hardware IDs, phone model strings, or personal paths.
153
+ - **Strict Outbound Whitelist**: Outbound downloads go through `minillama/net.py`, enforcing an allowlist (`*.huggingface.co`, `*.hf.co`, `*.github.com`, `*.githubusercontent.com`), manual redirect validation, cross-host credential stripping, and SHA-256 verification.
154
+ - **Loopback by Default**: Binds to `127.0.0.1` until you explicitly enable **Phone Link (LAN mode)** with rotating access tokens and short-lived 6-digit pairing codes.
155
+ - **Exact GGUF Context & Safe OOM Fallbacks**: Uses the model's true GGUF `context_length` by default without silently shrinking it, stepping down KV cache precision (`f16` -> `q8_0` -> `q4_0`) on OOM.
156
+ - **Standard Data Locations** (override via `MINILLAMA_HOME`):
157
+ - **Windows**: `%APPDATA%\MiniLlama` (config) & `%LOCALAPPDATA%\MiniLlama` (engines, models, logs)
158
+ - **macOS**: `~/Library/Application Support/MiniLlama`
159
+ - **Linux**: `$XDG_CONFIG_HOME/minillama` & `$XDG_DATA_HOME/minillama`
160
+
161
+ ---
162
+
163
+ ## Building the Wheel & Publishing to PyPI
164
+
165
+ ```bash
166
+ pip install build twine
167
+ python -m build --wheel # Creates dist/minillama-0.2.0-py3-none-any.whl
168
+ twine upload dist/*.whl # Publish to PyPI so anyone can run: pip install minillama
169
+ ```
170
+
171
+ ## Running Tests
172
+
173
+ ```bash
174
+ pytest -q
175
+ ```
176
+
177
+ ## License
178
+
179
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,2 @@
1
+ """MiniLlama: small private llama.cpp manager."""
2
+ __version__ = "0.2.1"
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())