llmhub_runtime
llmhub_runtime is a small Python library that lets you call LLMs by role using a simple YAML config (llmhub.yaml), while delegating all provider-specific logic to any-llm.
It is designed to be:
- Runtime-light – minimal dependencies, no discovery logic.
- Provider-agnostic – supports any provider that
any-llmsupports. - Role-centric – your application code never handles provider/model strings directly.
llmhub_runtime is intended for:
- Application backends (e.g. memory systems, agents, tools).
- The future
llmhubCLI/Web tool, which will generatellmhub.yamland then use this runtime internally.
Installation
pip install llmhub-runtime any-llm-sdk
(Exact package name to be confirmed when publishing.)
Runtime Config: llmhub.yaml
llmhub_runtime reads a generated config file, typically named llmhub.yaml:
project: memory
env: dev
providers:
openai:
env_key: OPENAI_API_KEY
anthropic:
env_key: ANTHROPIC_API_KEY
roles:
llm.preprocess:
provider: openai
model: gpt-4o-mini
mode: chat
params:
temperature: 0.2
max_tokens: 512
llm.inference:
provider: anthropic
model: claude-3-5-sonnet-20241022
mode: chat
params:
temperature: 0.7
max_tokens: 2048
You typically do not edit this by hand; it is generated by higher-level tools (e.g. llmhub CLI/Web).
Basic Usage
from llmhub_runtime.hub import LLMHub
hub = LLMHub(config_path="llmhub.yaml")
response = hub.completion(
role="llm.inference",
messages=[{"role": "user", "content": "Hello"}],
)
print(response)
Embeddings:
embedding = hub.embedding(
role="llm.embedding",
input="Hello world",
)
To override parameters per call:
response = hub.completion(
role="llm.inference",
messages=[...],
params_override={"temperature": 0.1},
)
Architecture Overview
llmhub_runtime is intentionally small and has three main layers:
-
Config layer
models.py– Pydantic models forRuntimeConfig,ProviderConfig,RoleConfig,ResolvedCall.config_loader.py– loads and validatesllmhub.yaml.
-
Resolution layer
resolver.py– maps a logicalrolename to{provider, model, mode, params}, with optional fallback fromdefaults.
-
Execution layer
hub.py– exposes theLLMHubclass:- Resolves roles.
- Calls
any-llm(completion/embedding) with the resolved settings. - Optional hooks for logging/metrics.
All domain-specific errors live in errors.py.
Design Principles
- No provider logic –
llmhub_runtimenever talks to provider SDKs directly; it only callsany-llm. - No discovery or scoring – it assumes
llmhub.yamlalready contains concrete provider/model choices. - Role-first – application code only sees role names; you can swap models by editing/generating
llmhub.yamlwithout changing app code.
Roadmap
- Async APIs (
acompletion,aembedding). - Streaming interfaces.
- More modes (
image,audio,tool). - Tight integration with the
llmhubCLI/Web for config generation.
Metadata
Release files for rethink-llmhub-runtime 2.3.0
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 | Actions |
|---|---|---|---|---|
| rethink_llmhub_runtime-2.3.0.tar.gz | 8.9 kB | Without provenance | Details for rethink_llmhub_runtime-2.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rethink_llmhub_runtime-2.3.0-py3-none-any.whl | Python 3 | none | any | Details for rethink_llmhub_runtime-2.3.0-py3-none-any.whl |
Total release size: 16.2 kB
Release files / rethink_llmhub_runtime-2.3.0.tar.gz
| Download URL | rethink_llmhub_runtime-2.3.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22f00aeac6e321d7f002f23220ed737af343b928206a319833cc660790b3a7db
|
|
BLAKE2b-256 checksum How to use checksums |
55964069f962f62029602dc096061073a729f72666240ffc2f452dba5ec2e112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / rethink_llmhub_runtime-2.3.0-py3-none-any.whl
| Download URL | rethink_llmhub_runtime-2.3.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b481766ad35d6b0bfd5aea0699216036b33f92d4cbdbafe932d6694823192c26
|
|
BLAKE2b-256 checksum How to use checksums |
ccafe46aa349ef1d50006809f9668451c33ceb454120f374edd646393333d064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for rethink-llmhub-runtime 2.3.0
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.