Best for
- Installing llamafile binary and GGUF model files
- Starting llamafile server with optimal configuration
- Integrating llamafile with LiteLLM or OpenAI SDK
Jamie-BitFlight/claude_skills/plugins/llamafile/skills/llamafile/SKILL.md
When setting up local LLM inference without cloud APIs. When running GGUF models locally. When needing OpenAI-compatible API from a local model. When building offline/air-gapped AI tools. When troubleshooting local LLM server connections.
Decision brief
Configure and manage Mozilla Llamafile - a cross-platform executable distribution format that runs LLMs locally with an OpenAI-compatible API.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/Jamie-BitFlight/claude_skills --skill "plugins/llamafile/skills/llamafile"Inspect the Agent Skill "llamafile" from https://github.com/Jamie-BitFlight/claude_skills/blob/a00194f25fec502d3d659b7d610369614967251e/plugins/llamafile/skills/llamafile/SKILL.md at commit a00194f25fec502d3d659b7d610369614967251e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Python script to start llamafile as background process with health checking:
Review the “Find process using port 8080” section in the pinned source before continuing.
kill $(lsof -t -i :8080) bash ls -lh /path/to/model.gguf bash ls -la /path/to/llamafile
Installing llamafile binary and GGUF model files
Llamafile combines llama.cpp with Cosmopolitan Libc to create single-file executables that:
Permission review
The documentation asks the agent to create, modify, or delete local files.
Llamafile combines llama.cpp with Cosmopolitan Libc to create single-file executables that:The documentation includes network, browsing, or remote request actions.
curl -L -o llamafile https://github.com/mozilla-ai/llamafile/releases/download/0.9.3/llamafile-0.9.3The documentation asks the agent to run terminal commands or scripts.
# Make executableThe documentation includes network, browsing, or remote request actions.
curl -LO https://huggingface.co/mozilla-ai/llava-v1.5-7b-llamafile/resolve/main/llava-v1.5-7b-q4.llamafileEvidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 92/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 64 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Configure and manage Mozilla Llamafile - a cross-platform executable distribution format that runs LLMs locally with an OpenAI-compatible API.
Use this skill when:
Llamafile combines llama.cpp with Cosmopolitan Libc to create single-file executables that:
/health endpoint for monitoring--embedding flagLlamafile exposes these OpenAI-compatible endpoints when running with --server:
| Endpoint | Description | Requirements |
|---|---|---|
http://localhost:8080/v1/chat/completions | Chat completions (primary) | Server mode |
http://localhost:8080/v1/completions | Text completions | Server mode |
http://localhost:8080/v1/embeddings | Generate embeddings | --embedding flag |
http://localhost:8080/health | Health check | Server mode |
Critical Detail: All OpenAI-compatible endpoints require /v1 prefix in the URL path.
# Download llamafile v0.9.3 binary
curl -L -o llamafile https://github.com/mozilla-ai/llamafile/releases/download/0.9.3/llamafile-0.9.3
# Make executable
chmod 755 llamafile
# Verify version
./llamafile --version
Alternative download sources:
https://github.com/mozilla-ai/llamafile/releases/download/0.9.3/llamafile-0.9.3https://sourceforge.net/projects/llamafile.mirror/files/0.9.3/Llamafile supports two approaches: pre-packaged llamafile executables (model embedded) or separate GGUF model files.
Pre-packaged llamafile (easiest):
# Download a llamafile with embedded model
curl -LO https://huggingface.co/mozilla-ai/llava-v1.5-7b-llamafile/resolve/main/llava-v1.5-7b-q4.llamafile
chmod +x llava-v1.5-7b-q4.llamafile
./llava-v1.5-7b-q4.llamafile --server --nobrowser
Separate GGUF model (use with ./llamafile --server -m model.gguf):
Download GGUF files from HuggingFace model publishers, then load with the llamafile binary.
Pre-packaged llamafile models from mozilla-ai:
| Model | Size | Use Case | Download |
|---|---|---|---|
| Qwen3-0.6B | ~500MB | Fast, lower quality | mozilla-ai/Qwen3-0.6B-llamafile |
| Mistral 7B v0.2 | ~4GB | Balanced speed/quality | mozilla-ai/Mistral-7B-Instruct-v0.2-llamafile |
| Llama 3.1 8B | ~5GB | Higher quality, slower | mozilla-ai/Meta-Llama-3.1-8B-Instruct-llamafile |
| LLaVA v1.5 7B | ~4GB | Multimodal (text+image) | mozilla-ai/llava-v1.5-7b-llamafile |
These are self-contained executables — download, chmod +x, and run. No separate llamafile binary needed.
Start llamafile server for local API access:
./llamafile --server \
-m /path/to/model.gguf \
--nobrowser \
--port 8080 \
--host 127.0.0.1
Critical flags explained:
--server: Required to enable HTTP API endpoints-m: Path to GGUF model file (required)--nobrowser: Prevents auto-opening browser on startup--port 8080: Default port (note: NOT 8000)--host 127.0.0.1: Localhost only (secure default)For GPU-accelerated inference with higher throughput:
./llamafile --server \
-m /path/to/model.gguf \
--nobrowser \
--port 8080 \
--host 127.0.0.1 \
--ctx-size 4096 \
--n-gpu-layers 99 \
--threads 8 \
--cont-batching \
--parallel 4
Advanced flags:
| Flag | Purpose | Default | When to Use |
|---|---|---|---|
--ctx-size | Prompt context window size | 512 | Increase for longer conversations |
--n-gpu-layers | GPU offload layer count | 0 | Set to 99 to offload all layers to GPU |
--threads | CPU threads for generation | Auto | Set explicitly for consistent performance |
--threads-batch | Threads for batch processing | Same as --threads | Tune separately for prompt vs generation |
--cont-batching | Continuous batching | Off | Enable for multiple concurrent requests |
--parallel | Parallel sequence count | 1 | Increase for concurrent request handling |
--mlock | Lock model in memory | Off | Prevent swapping on systems with sufficient RAM |
--embedding | Enable embeddings endpoint | Off | Required for /v1/embeddings API |
To allow connections from other machines (development/testing only):
./llamafile --server \
-m /path/to/model.gguf \
--nobrowser \
--host 0.0.0.0 \
--port 8080
Security warning: Binding to 0.0.0.0 exposes the API to network access. Use only in trusted environments.
LiteLLM provides unified interface for llamafile and cloud LLM providers.
import litellm
response = litellm.completion(
model="llamafile/gemma-3-3b", # MUST use llamafile/ prefix
messages=[{"role": "user", "content": "Hello, world!"}],
api_base="http://localhost:8080/v1", # MUST include /v1 suffix
temperature=0.3,
max_tokens=200,
)
print(response.choices[0].message.content)
Critical requirements for LiteLLM:
llamafile/ prefix for routingapi_base MUST include /v1 suffixRelated skill: For comprehensive LiteLLM configuration, activate the litellm skill:
Skill(skill: "litellm:litellm")
Direct integration with OpenAI SDK for llamafile endpoints:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1", # MUST include /v1
api_key="sk-no-key-required", # Any value works
)
response = client.chat.completions.create(
model="local-model", # Model name is flexible
messages=[{"role": "user", "content": "Hello, world!"}],
temperature=0.3,
max_tokens=200,
)
print(response.choices[0].message.content)
Verify llamafile server is responding correctly:
# Health check
curl http://localhost:8080/health
# Chat completions
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "local",
"messages": [{"role": "user", "content": "Hello"}],
"temperature": 0.3,
"max_tokens": 200
}'
# Embeddings (requires --embedding flag on server)
curl http://localhost:8080/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"model": "local",
"input": ["Hello world"]
}'
Python script to start llamafile as background process with health checking:
import subprocess
import time
import httpx
def start_llamafile(
llamafile_path: str, model_path: str, port: int = 8080, host: str = "127.0.0.1"
) -> subprocess.Popen:
"""Start llamafile server as background process."""
cmd = [llamafile_path, "--server", "-m", model_path, "--nobrowser", "--port", str(port), "--host", host]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
_wait_for_server(host, port)
return process
def _wait_for_server(host: str, port: int, timeout: int = 30) -> None:
"""Wait for server to respond to health checks."""
url = f"http://{host}:{port}/health"
start = time.time()
while time.time() - start < timeout:
try:
response = httpx.get(url, timeout=2)
if response.status_code == 200:
return
except httpx.RequestError:
pass
time.sleep(0.5)
raise TimeoutError(f"Server did not start within {timeout} seconds")
Example TOML configuration for applications using llamafile:
# ~/.config/app-name/config.toml
[ai]
model = "llamafile/gemma-3-3b" # Must use llamafile/ prefix
temperature = 0.3
max_tokens = 200
[llamafile]
path = "/home/user/.local/bin/llamafile"
model_path = "/home/user/.local/share/app-name/models/gemma-3-3b.gguf"
api_base = "http://127.0.0.1:8080/v1" # Include /v1 suffix
Check if port is already in use:
# Find process using port 8080
lsof -i :8080
# Kill existing process
kill $(lsof -t -i :8080)
Verify model file exists and is readable:
ls -lh /path/to/model.gguf
Check llamafile binary permissions:
ls -la /path/to/llamafile
# Should show: -rwxr-xr-x (executable)
# Fix permissions if needed
chmod 755 /path/to/llamafile
Verify server is running:
# Check health endpoint
curl http://localhost:8080/health
# Check server is listening
netstat -tlnp | grep 8080
# or
lsof -i :8080
Common causes:
--server flag/v1 in API URL path127.0.0.1 but accessing from another machineTest basic connectivity:
# Verbose health check
curl -v http://localhost:8080/health
# Test chat completions with verbose output
curl -v http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"test","messages":[{"role":"user","content":"Hi"}]}'
Common API issues:
| Error | Cause | Solution |
|---|---|---|
| 404 Not Found | Missing /v1 in URL | Add /v1 before endpoint path |
| Connection refused | Server not running | Start server with --server flag |
| Timeout | Model loading slowly | Wait longer or use smaller model |
| Invalid model | Wrong model path | Verify -m path to GGUF file |
Optimize inference speed:
--n-gpu-layers 99--threads 8--cont-batching--ctx-size 2048Check GPU availability:
# NVIDIA GPU
nvidia-smi
# AMD GPU
rocm-smi
# Apple Metal (check activity monitor)
Avoid these frequent errors when using llamafile:
/v1 in API URL: Always include /v1 suffix for OpenAI-compatible endpointsllamafile/ prefix in model name for proper routingchmod 755)--n-gpu-layers on CPU-only systems causes errorsCurrent stable version: 0.9.3 (May 14, 2025)
Version constants:
LLAMAFILE_MAJOR = 0
LLAMAFILE_MINOR = 9
LLAMAFILE_PATCH = 3
Recent changes in 0.9.3:
Skills to activate:
litellm - For unified LLM provider interface and routing
Skill(skill: "litellm:litellm")
External tools:
Frequently asked questions
Configure and manage Mozilla Llamafile - a cross-platform executable distribution format that runs LLMs locally with an OpenAI-compatible API.
The source record exposes this install command: npx skills add https://github.com/Jamie-BitFlight/claude_skills --skill "plugins/llamafile/skills/llamafile". Inspect the command and pinned source before running it.
Static rules flagged write-files, network, exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing