LLMHub
Lightweight gateway for routing LLM requests across providers.
Overview
LLMHub is a lightweight infrastructure layer that routes chat requests between multiple LLM providers.
It provides a single API and CLI interface to:
- switch between providers
- optimize cost and latency
- run locally or in production
Designed for developers building AI-powered apps without vendor lock-in.
Features
- Single
/chatendpoint powered by FastAPI - Multi-provider routing (Gemini, Ollama, optional OpenAI)
- Auto routing via rules or LLM-based agent
- CLI for local workflows
- .env-based configuration
- Fallback handling & latency tracking
- Business-friendly monitoring dashboard at
/monitoring/dashboard - Operational monitoring APIs (
/monitoring/overview,/monitoring/timeseries,/monitoring/failures)
Quick Start
1. Install
pip install -r requirements.txt
2. Configure
cp .env.example .env
Fill required keys.
3. Run server
uvicorn app.main:app --reload
Docs available at:
http://127.0.0.1:8000/docs
Example Request
{
"message": "Hello",
"preferred_provider": "auto",
"max_cost_tier": "low",
"timeout_ms": 120000
}
Example Response
{
"answer": "string",
"provider": "gemini",
"model": "string",
"latency_ms": 120,
"request_id": "uuid",
"fallback_used": false
}
CLI
Install:
pip install -e .
Usage:
llmhub chat "Hello" --provider auto
llmhub serve --reload
Routing Modes
rules
- Fast
- Deterministic
- Based on heuristics
agent
- Uses LLM (Gemini) for routing decisions
- More flexible, but adds latency and cost
Configuration
Environment variables:
GEMINI_API_KEYGEMINI_MODELOLLAMA_BASE_URLOLLAMA_MODELROUTER_MODEROUTER_MODEL
.envmust not be committed
Troubleshooting
-
Ollama 404
ollama pull llama3:8b
-
Gemini 404
- Check available models via API
Monitoring
Run service and open:
http://127.0.0.1:8000/monitoring/dashboard
Key endpoints:
/metrics- Prometheus scrape endpoint/monitoring/overview- KPI snapshot for selected time window/monitoring/timeseries- request/error/latency series for charting/monitoring/failures- latest failed requests list
Roadmap
- OpenAI provider stabilization
- Request caching
- Metrics dashboard
- Rate limiting
- Plugin system
License
MIT
Metadata
Release files for llmhub-gateway 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llmhub_gateway-0.1.1.tar.gz | 44.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llmhub_gateway-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.7 kB
Release files / llmhub_gateway-0.1.1.tar.gz
| Download URL | llmhub_gateway-0.1.1.tar.gz |
|---|---|
| Size | 44.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e2a5de3eecd3e7aad049de0b1c51612d783a42c5f89c039d84c365dd14e139d
|
|
BLAKE2b-256 checksum How to use checksums |
a84de17dfc85d00fd21ab71e155957d9af4b4fd0108795d9442cd1119a80c1dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / llmhub_gateway-0.1.1-py3-none-any.whl
| Download URL | llmhub_gateway-0.1.1-py3-none-any.whl |
|---|---|
| Size | 44.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
879d557106a1554e665a4051e8804ed36de92537b3fe92099e20e68ad2a50aa4
|
|
BLAKE2b-256 checksum How to use checksums |
d1812226f6d2fce239ae5e4f40756d4f14a7ad31247e7ea5eaa6567892da81df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for llmhub-gateway 0.1.1
Provenance
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.