llamafile Cheatsheet - Single-file Local LLM Run & Inference
All llamafile local-run commands in one place — from single-file launch to OpenAI-compatible server, GGUF loading to GPU acceleration — organized by scenario. Copy and go.
Get & Run 5
curl -L <release-url> > llamafile && chmod +x llamafileDownload and make executable
./mistral.llamafileRun directly (self-contained weights → Web UI :8080)
./llamafile --helpShow all flags
On Windows rename to llamafile.exeWindows needs .exe to run
sh -c ./llamafileFallback launch for old zsh
OpenAI-compatible Server 5
./xxx.llamafile --server --nobrowserOpenAI-compatible server (default :8080)
./xxx.llamafile --server --port 8081Set a custom port
./xxx.llamafile --server --host 0.0.0.0Allow LAN/external access
curl http://localhost:8080/v1/modelsList models served
openai_api_base=http://localhost:8080/v1Point OpenAI SDK at local server
Load External Weights 5
./llamafile -m ~/weights/foo.ggufRun with external GGUF weights
./llamafile -m model.gguf --temp 0.7 -p "..."Set temperature and a prompt
./llamafile -m model.gguf --n-gpu-layers 35Enable GPU (more layers = faster)
./llamafile -m model.gguf --image photo.jpg -p "describe this"Multimodal (needs mmproj)
./llamafile -m model.gguf --grammar 'root ::= "yes" | "no"'Constrain output with BNF
Embed & Offline 5
./embed.llamafile --server --embedding --port 8081Embedding server (for RAG)
Fully local, no data leaves the machinePrivacy/offline advantage
./llamafile -m w.gguf --no-display-promptHide prompt noise when scripting
zipalign to embed .args into the binaryBake default args; double-click to run
Single-file distro, cross-platform (mac/win/linux/bsd)Build once, run anywhere
Tips 5
Server defaults to :8080Different from vLLM :8000 — mind the client
More --ngl = faster but more VRAMSet layers by GPU VRAM
Self-contained build launches Web UIChat without the CLI
Pick it for offline-firstMost stable in air-gapped/sensitive envs
--grammar controls outputUse it for stable structure in scripts
Tips
- llamafile bundles llama.cpp + Cosmopolitan Libc into a single-file executable — build once, run on macOS/Windows/Linux/BSD. The most hassle-free local/offline LLM runner.
- Self-contained server builds launch a Web UI (:8080); with external GGUF use `-m` for the path and `--ngl` for GPU layers (more = faster but more VRAM).
- The OpenAI-compatible server defaults to :8080 (not vLLM's :8000); clients just change `base_url`. Use `--embedding` to serve an embedding model for RAG.
- Fully local, no data leaves the machine — first choice for privacy/air-gapped/offline. `--grammar` constrains output with BNF for stable scripting.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Aug 23, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact UsEdit this page on GitHub
Edit the source file directly and open a PR to improve this cheatsheet.