Skip to main content

Ollama-like CLI wrapper around llama.cpp

Project description

llamacpp-cli

Ollama-like CLI wrapper around llama.cpp. Provides a simple command-line interface that mirrors Ollama's subcommands but powered by llama.cpp as the backend inference engine.

Features

  • pull - Download GGUF models from Hugging Face
  • run - Run models interactively using llama.cpp
  • serve - Start the llama.cpp server
  • list - List downloaded models
  • ps - Show running llama.cpp processes
  • rm - Remove a downloaded model
  • search - Search Hugging Face for GGUF models
  • install - Install/update llama.cpp binaries

Installation

From PyPI

pip install llamacpp-cli

From Source

pip install -e .

Quick Start

1. Install llama.cpp binaries

llamacpp install

This downloads the latest llama.cpp release to ~/.llamacpp/bin/.

2. Pull a model

llamacpp pull unsloth/gemma-3-270m-it-GGUF:Q4_K_M

Or use a short alias:

llamacpp pull gemma3:270m

3. Run interactively

llamacpp run gemma3:270m

4. Start the server

llamacpp serve -m gemma3:270m

The server runs at http://localhost:8080 with OpenAI-compatible API.

Commands

llamacpp pull <model>    Download GGUF model from Hugging Face
llamacpp run <model>     Run a model interactively
llamacpp serve           Start the llama.cpp server
llamacpp list            List downloaded models
llamacpp ps              Show running processes
llamacpp rm <model>      Remove a model
llamacpp search <query>   Search for models on Hugging Face
llamacpp install          Install/update llama.cpp binaries

Model Names

Model names can be specified in multiple ways:

  • Full Hugging Face path: unsloth/gemma-3-270m-it-GGUF:Q4_K_M
  • Short format: namespace/model:quantization (e.g., gemma3:270m)
  • Short name: gemma3:270m, qwen3, llama3:8b

Alias support is planned for future releases.

Configuration

  • Models are stored in ~/.llamacpp/models/
  • Binaries are installed to ~/.llamacpp/bin/
  • Database (SQLite) is at ~/.llamacpp/llamacpp.db

Environment Variables

Variable Description Default
LLAMACPP_BIN_DIR Directory for llama.cpp binaries ~/.llamacpp/bin
LLAMACPP_MODEL_DIR Directory for models ~/.llamacpp/models

Usage with LLM CLI

This package also registers as an LLM plugin for the llm CLI:

# Install the plugin (requires llm and llama-cpp-python)
pip install llm-llama-cpp llama-cpp-python

# Register a model
llm llama-cpp add-model ~/.llamacpp/models/gemma-3-270m-it-Q4_K_M.gguf --alias gemma3:270m

# Use with llm
llm -m gemma3:270m "Your prompt here"

Development

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run a single test file
pytest tests/test_foo.py

# Lint
ruff check .

# Format
ruff format .

Publishing to PyPI

Prerequisites

  1. Create a PyPI account at https://pypi.org/
  2. Install build tools:
pip install build twine

Build and Publish

  1. Update version in pyproject.toml:
[project]
version = "0.1.0"
  1. Build the package:
python -m build

This creates distributable archives in dist/.

  1. Upload to PyPI:
twine upload dist/*

You'll be prompted for your PyPI username and password.

For Test PyPI (testing first):

twine upload --repository testpypi dist/*

Using uv (Alternative)

# Install uv if not already
pip install uv

# Build
uv build

# Publish to PyPI
uv publish

# Or Test PyPI
uv publish --test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llamacpp_cli-0.1.2.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llamacpp_cli-0.1.2-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file llamacpp_cli-0.1.2.tar.gz.

File metadata

  • Download URL: llamacpp_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llamacpp_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ad92f0f45bbd6e551f5a73975cc4912e728ed6dc36d23b4dda26c821a785aa0c
MD5 257a7f99d46e9d14be841939c8dae86b
BLAKE2b-256 034f1176eaef24013018c9e80b4a1199b0c23e541986285ee0420e0ea4130f07

See more details on using hashes here.

Provenance

The following attestation bundles were made for llamacpp_cli-0.1.2.tar.gz:

Publisher: publish.yml on joeyjiaojg/llamacpp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llamacpp_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llamacpp_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llamacpp_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a44573a7f7a1ec2398cd2efe686af2961ad988ced8209b3a01ee7a021645ff1d
MD5 4a61daa0497d76b713252df04c949f7c
BLAKE2b-256 9bec0a78d8cebf1b3e1cde452934f2f46b1a017fff0ddf3e16bd277dd8491052

See more details on using hashes here.

Provenance

The following attestation bundles were made for llamacpp_cli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on joeyjiaojg/llamacpp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page