Skip to main content

Smart LLM routing with TIBET provenance - route queries to the right model automatically

Project description

LLM Router

Smart LLM routing with TIBET provenance - route queries to the right model automatically

PyPI License: MIT

Quick Start

from llm_router import LLMRouter

# Simple usage
llm = LLMRouter()
response = llm.generate("Hello!")

# Auto-routing (picks best model for your query)
llm = LLMRouter(auto_route=True)
response = llm.generate("Write a Python function")  # Routes to code model
response = llm.generate("Quick question")  # Routes to fast model

Installation

pip install llm-router

# With TIBET provenance tracking
pip install llm-router[tibet]

Features

  • Auto-Routing: Automatically selects the best model for your query
  • Code Detection: Routes code queries to specialized code models
  • Complexity Analysis: Complex queries go to reasoning models
  • TIBET Provenance: Full audit trail of all LLM calls
  • Ollama Integration: Works with any Ollama-compatible backend

CLI Usage

# Generate text
llm-router gen "Write a haiku about AI"

# Auto-route
llm-router gen --auto "Complex philosophical question"

# Preview routing
llm-router route "Write Python code"
# Output: Model: deepseek-coder:6.7b, Reason: code query detected

# Interactive chat
llm-router chat --auto

# Check status
llm-router status

With TIBET Provenance

from llm_router import LLMRouter
from tibet_core import Provider

# Track all LLM calls
tibet = Provider(actor="my_app")
llm = LLMRouter(tibet=tibet, auto_route=True)

response = llm.generate("Explain quantum computing")
# Full provenance chain: who, what, when, why

Model Configuration

from llm_router import LLMRouter, ModelRouter, ModelConfig, ModelCapability

# Custom router
router = ModelRouter()
router.add_model(ModelConfig(
    name="my-custom-model:7b",
    size="7b",
    capabilities=[ModelCapability.CODE, ModelCapability.FAST],
    priority=50  # Higher = preferred
))

llm = LLMRouter(router=router, auto_route=True)

Environment Variables

Variable Default Description
OLLAMA_URL http://localhost:11434 Ollama API URL

Part of Humotica Stack

LLM Router is part of the Humotica AI ecosystem:

Package Description
tibet-core TIBET provenance tracking
oomllama .oom format Q2/Q4 quantization
rapid-rag Local RAG with semantic search

Links


One Love, One fAmIly

Built by Humotica AI Lab - Jasper, Claude, Gemini

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

tibet_router-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

tibet_router-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file tibet_router-0.1.0.tar.gz.

File metadata

  • Download URL: tibet_router-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c408fb6eac89ed2dfb19e8d3c2bf35cc3d608cf8d4dd3f63899bea918f25afa
MD5 6fca6ddac1f2db83f1477fda94a22a1b
BLAKE2b-256 457fc6c2b40fcc3200da0bbb03d5ce609dfe9a881414ff874f3ea1b2548330a3

See more details on using hashes here.

File details

Details for the file tibet_router-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tibet_router-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 366d227335d2dd9ca4a45e8cbdee8c533c81026f6acaafa1aeefa92c6a0a8775
MD5 89a5ed6bc71654a1ac5c67ce3553fac4
BLAKE2b-256 a56afc2833bb9cb3c124448d04373f12a3a7120780825a455219b5b2e4e4f728

See more details on using hashes here.

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