ワンクリックで
llama-cpp
Run quantized LLMs locally with llama.cpp — CPU+GPU inference, GGUF format, OpenAI-compatible server, and Python bindings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Run quantized LLMs locally with llama.cpp — CPU+GPU inference, GGUF format, OpenAI-compatible server, and Python bindings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Compress conversation context — summarize the current session, extract key decisions and facts, then compact history to free up context window.
Generate insights about your Claude Code usage — what topics you work on most, common patterns, productivity trends.
Route Claude Code work by complexity, risk, and tool needs. Use when deciding how much reasoning depth a task needs, whether to read project memory first, whether the task should be decomposed, and whether the work is lightweight, standard, or investigation-heavy.
Query Polymarket prediction markets for probability data and research insights on real-world events.
Search and retrieve academic papers from arXiv using their free REST API. No API key needed.
Query Base (Ethereum L2) blockchain data — wallet balances, token info, transactions, gas analysis, contract inspection. No API key required.
| name | llama-cpp |
| description | Run quantized LLMs locally with llama.cpp — CPU+GPU inference, GGUF format, OpenAI-compatible server, and Python bindings. |
| version | 1.0.0 |
| author | hermes-CCC (ported from Hermes Agent by NousResearch) |
| license | MIT |
| metadata | {"hermes":{"tags":["MLOps","llama-cpp","Local-Inference","GGUF","Quantization","CPU"],"related_skills":[]}} |
llama.cpp is especially useful for CPU-first deployments, low-cost GPU offload, and offline workflows.llama-cpp-python.pip install llama-cpp-python
python -c "from llama_cpp import Llama; print('ok')"
llama.cpp primarily uses the GGUF model format.Hugging Face is the standard source for GGUF checkpoints.
Common repos include:
bartowski/*
TheBloke/*
Typical examples:
bartowski/Llama-3.1-8B-Instruct-GGUF
TheBloke/Mistral-7B-Instruct-v0.2-GGUF
bartowski/Qwen2.5-7B-Instruct-GGUF
Store the downloaded file locally, for example:
models/llama-3.1-8b-instruct-q4_k_m.gguf
Q4_K_M: best balance for many local deployments
Q5_K_M: more quality, more RAM or VRAM
Q8_0: highest quality among common quantized options
Q2_K: very small, but quality drops sharply
Start with Q4_K_M unless you already know the task is quality-sensitive.
Move to Q5_K_M or Q8_0 for coding, reasoning, or long-form generation where quality matters more.
Use Q2_K only for extreme memory constraints or experiments.
from llama_cpp import Llama
llm = Llama(
model_path="models/llama-3.1-8b-instruct-q4_k_m.gguf",
n_ctx=8192,
n_threads=8,
n_gpu_layers=0,
)
output = llm(
"Explain why GGUF is useful for local inference.",
max_tokens=256,
temperature=0.7,
)
print(output["choices"][0]["text"])
model_path: path to the .gguf file on disk
n_gpu_layers: number of transformer layers to offload to GPU
n_ctx: context size, constrained by the model and available memory
n_threads: CPU worker threads for prompt processing and generation
These four parameters are the first tuning knobs to adjust for almost every deployment.
model_path on a local SSD when possible.n_threads close to the number of performant CPU cores, not necessarily total logical threads.n_ctx only after checking memory pressure.n_gpu_layers gradually if the model fails to load or performance is unstable.result = llm(
"Write a short checklist for running a local LLM service.",
max_tokens=256,
temperature=0.7,
)
print(result["choices"][0]["text"])
max_tokens bounded for interactive usage.from llama_cpp import Llama
llm = Llama(
model_path="models/qwen2.5-7b-instruct-q4_k_m.gguf",
n_ctx=8192,
n_gpu_layers=20,
n_threads=8,
)
response = llm.create_chat_completion(
messages=[
{"role": "system", "content": "You are concise and technical."},
{"role": "user", "content": "List three tradeoffs of 4-bit quantization."},
],
max_tokens=256,
temperature=0.4,
)
print(response["choices"][0]["message"]["content"])
stream = llm.create_chat_completion(
messages=[
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Describe GPU offload in llama.cpp."},
],
max_tokens=128,
temperature=0.3,
stream=True,
)
for chunk in stream:
delta = chunk["choices"][0].get("delta", {})
text = delta.get("content")
if text:
print(text, end="", flush=True)
n_gpu_layers=-1 means full GPU offload when supported by the backend and hardware.N layers:llm = Llama(
model_path="models/mistral-7b-instruct-q5_k_m.gguf",
n_ctx=8192,
n_threads=8,
n_gpu_layers=-1,
)
20, 30, or 40.from llama_cpp import Llama
llm = Llama(
model_path="models/phi-3-mini-q4_k_m.gguf",
n_ctx=4096,
n_threads=12,
n_gpu_layers=0,
)
n_ctx controls the context window in tokens.4096 or 8192.n_ctx values can degrade throughput significantly.llama-cpp-python includes a server mode:python -m llama_cpp.server --model model.gguf
python -m llama_cpp.server \
--model models/llama-3.1-8b-instruct-q4_k_m.gguf \
--host 0.0.0.0 \
--port 8000 \
--n_ctx 8192
from openai import OpenAI
client = OpenAI(
api_key="dummy",
base_url="http://localhost:8000/v1",
)
resp = client.chat.completions.create(
model="local-model",
messages=[
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Summarize Q4_K_M vs Q8_0."},
],
max_tokens=128,
)
print(resp.choices[0].message.content)
Build from source when:
you need CUDA acceleration not available in your wheel
you want Metal on macOS
you need a specific compiler or backend flag
you are packaging for a controlled deployment target
Source builds take more effort but often deliver better hardware utilization.
Llama
Qwen
Mistral
Phi
Gemma
Check the prompt format and tokenizer notes for each family before deploying.
Model will not load:
verify model_path
verify the file is a GGUF checkpoint
verify the quantization is supported by your build
Very slow generation:
increase n_threads
enable GPU offload
reduce n_ctx
use a smaller model
Out-of-memory:
reduce n_ctx
choose Q4_K_M instead of Q8_0
reduce n_gpu_layers or use CPU-only mode
Bad chat formatting:
use create_chat_completion
verify the checkpoint is instruct-tuned
check whether the model expects a specific chat template
pip install llama-cpp-pythonfrom llama_cpp import Llamamodel_path, n_gpu_layers, n_ctx, n_threadsllm("prompt", max_tokens=256, temperature=0.7)llm.create_chat_completion(messages=[...])python -m llama_cpp.server --model model.ggufQ4_K_Mn_gpu_layers=-1