Modern local AI gateway — OpenAI-compatible, GGUF-native
pip install vipera-ai==1.2.0 Copy PIP instructions
Quick start · CLI · HTTP API · Docs · Contributing
Vipera turns a .gguf file into a production-shaped, OpenAI-compatible HTTP endpoint — in a single command. It reads the hardware it's running on, plans which layers belong in VRAM, RAM, or disk, and then drives llama.cpp with the exact flags that plan implies. No reimplemented runtime, no second inference engine, no guessing.
pip install "vipera-ai[llama,gguf,nvidia] @ git+https://github.com/vipera-iso/vipera.git" vipera model search # download a GGUF from HuggingFace vipera serve start # → http://127.0.0.1:8686/v1/chat/completions The distribution is named vipera-ai; it is not on PyPI yet. The PyPI project named vipera is an unrelated tool, so do not install that. Use the GitHub source command above, or follow the no-Git installation guide.
That endpoint speaks the OpenAI Chat Completions protocol with real SSE streaming, so every existing client — openai-python, LangChain, LlamaIndex, Continue, the OpenAI Playground — works without code changes.
Most local LLM tools make you choose between a friendly CLI and a real server. Vipera is both, with a planner in the middle that most tools skip.
# 1. install (see docs/install.md for a no-Git option) pip install "vipera-ai[llama,gguf,nvidia] @ git+https://github.com/vipera-iso/vipera.git" # 2. fetch a model vipera model search # 3. serve it vipera serve start That's it. Then point any OpenAI client at http://127.0.0.1:8686/v1:
from openai import OpenAI client = OpenAI(base_url="http://127.0.0.1:8686/v1", api_key="none") stream = client.chat.completions.create( model="default", messages=[{"role": "user", "content": "Explain MoE in one paragraph."}], stream=True, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="") 🧭 CLI reference Vipera ships a single vipera entry point. Every command is discoverable with vipera --help.
flowchart LR subgraph Client C1["openai-python"] C2["curl"] C3["OpenAI SDK"] end subgraph Vipera["Vipera Gateway"] S["FastAPI server"] E["Engine"] P["Planner"] H["Hardware probe"] R["Registry"] end M[("GGUF file")] C1 & C2 & C3 -->|"HTTP / SSE"| S S -->|"chat()"| E E -->|"reads"| M P -->|"flags"| E H --> P R --> P Layers:
Config lives at ~/.vipera/config.json. Set it via vipera system config, or edit the JSON — unknown keys are rejected, known keys are type-coerced.
~/.vipera/ ├── config.json # gateway config ├── registry.json # model index ├── models/ # *.gguf artifacts └── logs/ # reserved Override the home with VIPERA_HOME=/path/to/dir.
vipera model inspect reads the GGUF index only — weights are never loaded into memory — and prints the architecture, layer/context/embedding sizes, a size breakdown by tensor category (embedding, attention, FFN, expert, norm), and the quantization mix.
vipera model inspect ~/.vipera/models/model.gguf vipera model inspect ~/.vipera/models/model.gguf --tensors # every tensor It warns when quality-sensitive tensors (attn_v, ffn_down, including their _exps variants) are quantized below Q4_K. That check is a heuristic, not a quality measurement.
An importance matrix (imatrix) tells llama-quantize which weights matter for your data, so low-bit quants keep more of the quality. Generate one from a plain-text calibration file, then quantize with it:
vipera model imatrix model.gguf --calibration-data calibration.txt vipera model quantize model.gguf --imatrix model.imatrix.gguf --target-quant q4_k_m quantize writes -vipera- .gguf next to the source unless --output is given. Requantizing an already-quantized file needs --allow-requantize; expect a quality loss. For MoE models, --prior-weight raises the expert prior (try 128 for models with many rarely-used experts to avoid NaNs) when the installed llama-quantize supports the flag.
optimize inspects the file, picks the highest-quality K-quant that fits the size budget, optionally builds an imatrix, and quantizes:
vipera model optimize model.gguf --target-size 4.5 --calibration-data calibration.txt vipera model optimize model.gguf --target-quant q4_k_m The size estimate assumes a roughly uniform per-weight cost; actual output can differ, especially for models with large output embeddings or MoE experts. --prune-layers is passed through to llama-quantize and can substantially reduce quality.
All three commands need llama-imatrix and llama-quantize from a llama.cpp build. Vipera finds them on PATH, in $VIPERA_LLAMA_BIN, in a few common build directories, or via --bin-dir. Every command accepts --dry-run to print the exact llama.cpp invocation without running it.
Vipera measures what the gateway actually produces, on the machine it runs on. Numbers below are from the reference box; re-run with vipera bench run on yours — that is the point.
Read this as: on a model that already fits in RAM, this class of gateway does not beat llama.cpp defaults — the load-flag layer (mlock, n_batch) moves throughput 1.4× while placement does not, because there is nothing to place. Vipera earns its keep at the edges: when the model spills RAM, when the machine has multiple accelerators of different capabilities, or when the operator does not know which of forty flags to pass. vipera bench run is the instrument; the numbers are yours.
Issues and PRs are welcome. First-timers: look for good first issue.
git clone https://github.com/vipera-iso/vipera cd vipera python -m venv .venv && .venv/bin/pip install -e ".[dev,llama,gguf]" .venv/bin/pre-commit install .venv/bin/pytest -q See CONTRIBUTING.md for the full guide.
gateway gguf inference llama.cpp llm local-ai moe openai openai-api streaming
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.




