本地 LLM Runtime 与 GGUF 模型管理工具
Project description
llm-nest
Local LLM runtime and GGUF model management tool. Think of it as ollama for your terminal — lightweight, offline-first, no daemon required.
Features
- Model management — search, download, list, and delete GGUF models from HuggingFace Hub
- Interactive chat — REPL mode with multi-turn conversation and streaming output
- API server — OpenAI-compatible
/v1/chat/completionsendpoint with SSE streaming
Install
pip install llm-nest-python
With API server support (FastAPI + uvicorn):
pip install llm-nest-python[server]
From source (uv)
git clone https://github.com/NingCold/llm-nest-python.git
cd llm-nest-python
uv sync
uv run llmn --help
Quick Start
Download a model
llmn hub get tensorblock/tinyllama-15M-GGUF -f tinyllama-15M-Q4_K_M.gguf
List local models
llmn model list
Run interactive chat
llmn run tinyllama-15M-Q4_K_M
Loading model: tinyllama-15M-Q4_K_M (Q4_K_M, 0.0GB) ...
Type 'exit' or press Ctrl+C to quit
You: Hello
Assistant: Hello! How can I help you?
You: exit
Bye!
Single-shot inference
llmn run tinyllama-15M-Q4_K_M -p "What is 2+2?" --max-tokens 50
With system prompt
llmn run tinyllama-15M-Q4_K_M -s "You are a helpful assistant."
API Server
Start an OpenAI-compatible HTTP server:
llmn serve tinyllama-15M-Q4_K_M --port 8000
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/v1/models |
GET | List loaded models |
/v1/chat/completions |
POST | Chat completion (stream + non-stream) |
Usage with curl
# Non-streaming
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello"}]}'
# Streaming (SSE)
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello"}], "stream": true}'
Usage with OpenAI Python SDK
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key="none")
resp = client.chat.completions.create(
model="tinyllama-15M-Q4_K_M",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
Commands
llmn model list # List local models
llmn model search <query> # Search local + Hub models
llmn model info <name> # Show model details
llmn model remove <name> # Delete a local model
llmn hub search <query> # Search HuggingFace Hub
llmn hub get <repo_id> [-f filename] # Download model from Hub
llmn run <model> [-p prompt] [-s system] # Interactive chat or single-shot
llmn serve <model> [--port 8000] # Start API server
llmn lang zh # Switch to Chinese
llmn lang en # Switch to English
llmn version # Show version
Storage
Models are stored in ~/.llmn/models/. Config is at ~/.config/llm-nest/config.json.
Development
uv sync
uv run pytest
uv run ruff check .
uv run pyright
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_nest_python-0.1.0.tar.gz.
File metadata
- Download URL: llm_nest_python-0.1.0.tar.gz
- Upload date:
- Size: 97.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80caf4f43976f7d6d2e037edc387eab08b2ffd0c00ff7b8a4b0b294f5e357b7a
|
|
| MD5 |
b005b0cac364ee050992b570817d2812
|
|
| BLAKE2b-256 |
fa365b5b9ecec42f99a9bc947b89174c8fb986aee2e02b6ec5f3067cf4804279
|
File details
Details for the file llm_nest_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_nest_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de1fa1b2cdbe799600110950484091c8ea155999462caa111fad708ae48e10ad
|
|
| MD5 |
4f5a2e55085c0d8fee4b30d1dd764d63
|
|
| BLAKE2b-256 |
bf67fc5b037704f2673bbf11575d1dc6e6253ee18dd6bf5fd440bc3fd0b2528f
|