Turn any machine or Google Colab notebook into a one-line AI model server with an auto-generated public API.
Project description
LLMmodelHub
Turn any local machine or Google Colab notebook into a production-ready AI model server with a single line of code.
pip install LLMmodelHub
from LLMmodelHub import load_model
hub = load_model("TheBloke/Llama-2-7B-Chat-GGUF")
print(hub.local_url) # http://0.0.0.0:5000
print(hub.public_url) # https://xxxx.ngrok-free.app -- works out of the box
hub.chat() # interactive terminal chat (or a widget UI in Colab)
Features
- One-line model loading — pulls models straight from Hugging Face, including quantized GGUF files for consumer hardware.
- LLM + VLM support — text models and vision-language models behind one API.
- Automatic REST API — an OpenAI-compatible
/v1/chat/completionsendpoint is spun up the moment the model loads. - Public tunneling built in —
pyngrokships as a core dependency, so everyload_model(...)call gets a publichttps://...ngrok-free.appURL automatically (falls back to acloudflaredquick tunnel if ngrok can't start). No separate ngrok install needed. For a stable, non-rate-limited URL, grab a free authtoken from ngrok.com and runfrom pyngrok import ngrok; ngrok.set_auth_token("...")once. - Terminal chat UI — color-coded, with
/image,/clear,/urlcommands. - Colab widget UI — chat box, image upload, and URL display inside the notebook.
- Caching — downloaded models are cached locally and reused.
- Optional security — API key auth, CORS, and rate limiting.
Installation
pip install LLMmodelHub # core (API + downloader only)
pip install "LLMmodelHub[llm]" # + transformers/torch for full HF models
pip install "LLMmodelHub[gguf]" # + llama-cpp-python for GGUF models
pip install "LLMmodelHub[colab]" # + ipywidgets for the notebook UI
pip install "LLMmodelHub[full]" # everything
Usage
Load a full Hugging Face model
from LLMmodelHub import load_model
hub = load_model("meta-llama/Llama-2-7b-chat-hf", model_type="llm")
reply = hub.generate("Explain quantum computing in one sentence.")
print(reply)
Load a quantized GGUF model
hub = load_model("TheBloke/Llama-2-7B-Chat-GGUF", filename="llama-2-7b-chat.Q4_K_M.gguf")
Load a vision-language model
hub = load_model("Salesforce/blip2-opt-2.7b", model_type="vlm")
reply = hub.generate("What is in this image?", image_path="cat.jpg")
Call the REST API from anywhere
curl -X POST "$PUBLIC_URL/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello!"}]}'
Stop the server
hub.stop()
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
llmmodelhub-0.1.0.tar.gz
(12.8 kB
view details)
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 llmmodelhub-0.1.0.tar.gz.
File metadata
- Download URL: llmmodelhub-0.1.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a066e2bdd97a67f315274d79092d9be941295cad7623364e2f432f954ed8662
|
|
| MD5 |
baa02b768783ace9bd412051a91baa0a
|
|
| BLAKE2b-256 |
380b105d841bfc5aa47271c59a360e80b2d52d882075a251627f5cb3fd10b40e
|
File details
Details for the file llmmodelhub-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmmodelhub-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a166cad6bb26a1992e793473b023ab19051a3e1c28a4a6ffc9736faa7187229
|
|
| MD5 |
7530b104eee4d10e63f862473f401649
|
|
| BLAKE2b-256 |
5bc7bfa887b94557252d37ad448a3f19f4ff60aaab254136c1e9211f20d5fbd0
|