Skip to main content

Smart LLM routing with TIBET provenance - route queries to Ollama/OpenAI/Anthropic automatically

Project description

TIBET LLM Router

Smart LLM routing with TIBET provenance - route queries to Ollama/OpenAI/Anthropic automatically

PyPI License: MIT

Note: This package replaces tibet-router. The name tibet-router is reserved for TIBET token routing (like jis-router for RABEL).

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 tibet-llm-router

# With TIBET provenance tracking
pip install tibet-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_llm_router-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

tibet_llm_router-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tibet_llm_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51d552010fa322ede61515b9f1da0050c1e5b56c5690f9d7984d426bd605ebdf
MD5 bb7123d231e6876f673ab61ba5455e60
BLAKE2b-256 474b5350b45b7f777b51933258031021ab62310b37fe6970bd80030675e0ef86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tibet_llm_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a31449514d22a08175cf67505a58ce4ee40f6eede7d46c1045693f177921d6cb
MD5 49669eec4c3148a6bc53541875a273be
BLAKE2b-256 4a1313f3a2ddb339704d770ce3e91ef1c14be4f56fe22fa1a292f7f758b6a522

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