llamafile — Single-File LLM, No Install Needed
llamafile distributes LLMs as single-file executables that run on any OS. 23.9K+ GitHub stars. No installation, cross-platform, built on llama.cpp + Cosmopolitan. Apache 2.0.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install f30a667e-1b6a-4140-a92f-b5027f16c8bc --target codex先 dry-run,确认写入项后再运行此命令。
What it is
llamafile packages a large language model and its inference engine into a single executable file that runs on Windows, macOS, Linux, and FreeBSD without any installation. The project combines llama.cpp (the inference engine) with Cosmopolitan libc (a cross-platform binary format) to create truly portable LLM executables. Download one file, make it executable, and run it.
This tool targets developers, researchers, and anyone who wants to run LLMs locally without dealing with Python environments, package managers, or GPU driver setup. llamafile is the simplest path from zero to a running local LLM.
How it saves time or tokens
llamafile eliminates the entire setup process for running local LLMs. No pip install, no conda environment, no model downloading step, no configuration files. A single chmod +x && ./model.llamafile gets you a running model with a web UI. This saves the 30-60 minutes typically spent on local LLM setup and avoids all API token costs by running entirely on your hardware.
How to use
- Download a llamafile from Hugging Face (Mozilla publishes several popular models)
- Make it executable with
chmod +x - Run it directly; a web UI opens at localhost for chat
Example
# Download a model (e.g., Qwen 0.8B)
curl -LO https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-0.8B-Q8_0.llamafile
# Make executable and run
chmod +x Qwen3.5-0.8B-Q8_0.llamafile
./Qwen3.5-0.8B-Q8_0.llamafile
# Web UI opens at http://localhost:8080
# Or use the API:
curl http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages":[{"role":"user","content":"Hello"}]}'
Related on TokRepo
- Local LLM tools — Compare llamafile with Ollama, LM Studio, and other local runners
- Local LLM with llama.cpp — llamafile's underlying inference engine
Common pitfalls
- Large models (7B+) require significant RAM; the file size roughly indicates the memory needed at runtime
- GPU acceleration works but may need specific flags depending on your GPU vendor and driver version
- Windows may flag the executable as untrusted; you need to allow it through SmartScreen or Defender
常见问题
Mozilla publishes several popular models on Hugging Face in llamafile format, including Llama, Mistral, and Qwen variants. Community members also publish their own conversions. Any GGUF model can be converted to llamafile format.
Yes. llamafile supports NVIDIA CUDA, Apple Metal, and AMD ROCm for GPU acceleration. The appropriate backend is selected automatically on most systems. Use --gpu flag to force GPU offloading.
File size depends on the model and quantization level. A small 0.8B model at Q8 quantization is around 1GB. A 7B model at Q4 is around 4GB. The executable includes both the model weights and the inference engine.
Yes. llamafile starts an OpenAI-compatible API server alongside the web UI. Any tool that works with the OpenAI API format can connect to llamafile at localhost:8080 as a drop-in local replacement.
Cosmopolitan libc is a C library that produces single binaries running on multiple operating systems. llamafile uses it to create one executable that works on Windows, macOS, Linux, and FreeBSD without recompilation.
引用来源 (3)
- llamafile GitHub— Single-file LLM executables with Cosmopolitan libc
- Cosmopolitan libc— Cross-platform binary format via Cosmopolitan
- llama.cpp GitHub— llama.cpp inference engine for GGUF models
来源与感谢
Created by Mozilla. Licensed under Apache 2.0. Mozilla-Ocho/llamafile — 23,900+ GitHub stars
讨论
相关资产
KoboldCpp — Single-File Local LLM Inference Engine
KoboldCpp is a self-contained local LLM inference engine that runs GGUF models with GPU acceleration on consumer hardware, providing an OpenAI-compatible API and built-in web UI without requiring Python or complex setup.
Zola — Fast Static Site Generator in a Single Rust Binary
Zola is a fast static site generator built as a single Rust binary with everything built in: Sass compilation, syntax highlighting, table of contents, search index, image processing, and shortcodes. No external dependencies or plugins needed.
CleanRL — Single-File Reinforcement Learning Implementations
A collection of single-file, self-contained implementations of popular reinforcement learning algorithms in PyTorch, designed for clarity, reproducibility, and easy modification by researchers and practitioners.
PairDrop — Local File Sharing in Your Browser
PairDrop is a self-hosted, web-based file sharing tool inspired by Apple AirDrop. It lets you transfer files, text, and links between devices on the same network — or across the internet via room codes — without any app install.