Skip to main content

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 /chat endpoint 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_KEY
  • GEMINI_MODEL
  • OLLAMA_BASE_URL
  • OLLAMA_MODEL
  • ROUTER_MODE
  • ROUTER_MODEL

.env must 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.ai 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llmhub.ai 0.1.2
File Size Uploaded Provenance
llmhub_ai-0.1.2.tar.gz 44.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llmhub.ai 0.1.2
File Interpreter ABI Platform
llmhub_ai-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 88.6 kB

Release files / llmhub_ai-0.1.2.tar.gz

Download URL llmhub_ai-0.1.2.tar.gz
Size 44.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ed608085bacdc87e50eebb17317d4c5d77bf88e2992d8fb386c31f8b72847bbf
BLAKE2b-256 checksum
How to use checksums
5c631130421034a942af9bcff925bad0203ae94f7f6e28afde256e48e3439f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / llmhub_ai-0.1.2-py3-none-any.whl

Download URL llmhub_ai-0.1.2-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cafe757d2b4078d94a8b914a7e7c7647497bfb7d06443afb2a55ee4df35e5a96
BLAKE2b-256 checksum
How to use checksums
145c82f6cf745d91b2fdd29508ae56a55fe2802e80ae1b1ef90b0c2419084559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for llmhub.ai 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page