llm_router →

Provider-agnostic LLM router with YAML routing, auto-failover, cost telemetry, and multi-model support.
One API. Any provider. Zero vendor lock-in.
llm_router is a small Python package (~500 LOC core) that gives you a uniform call_tool() interface across Anthropic, DeepInfra, OpenRouter (30+ models), and more. Define routing rules in YAML — change providers without touching application code. In production since May 2026 powering second-brain-instance.
Why llm_router?
- 🔀 Multi-provider by default — Anthropic, DeepInfra, OpenRouter. Add more via config.
- 🛡️ Auto-failover — provider down? Router switches to fallback automatically (circuit breaker)
- 💰 Cost-aware — route to cheapest available model. Daily budget guard.
- 📊 Telemetry built-in — every call logged (provider, model, tokens, cost, latency)
- 📝 YAML-only config — change routing rules without touching code
- 🇵🇱 Polish-optimized — routing rules aware of PL language quality per model
- 🧩 Drop-in — replace direct
anthropicSDK calls withcall_tool(use_case=..., ...)
Quick Start
pip install llm-router
from llm_router import call_tool, set_routing_config
# One-time setup (put in your app's __init__)
set_routing_config('config/llm_routing.yaml')
# Use anywhere — same API regardless of provider
result, usage = call_tool(
use_case='myapp.feature_x',
system='You are a helpful assistant.',
user='Summarize this text: ...',
schema={'name': 'summarize', 'input_schema': {...}},
)
print(f'${usage.cost_usd:.4f} via {usage.provider}/{usage.model}')
Full walkthrough: docs/INTEGRATION.md (5 min).
Configuration
# config/llm_routing.yaml
providers:
deepinfra:
api_key_env: DEEPINFRA_API_KEY
default_model: Qwen/Qwen3.5-397B-A17B
openrouter:
api_key_env: OPENROUTER_API_KEY
base_url: https://openrouter.ai/api/v1
anthropic:
api_key_env: ANTHROPIC_API_KEY
use_cases:
myapp.feature_x:
primary: { provider: deepinfra, model: Qwen/Qwen3.5-397B-A17B }
fallback:
- { provider: openrouter, model: qwen/qwen3.5-397b-a17b }
- { provider: anthropic, model: claude-haiku-4-5-20251001 }
cost_stop_per_call_usd: 0.50
Status
✅ In production — routing all LLM calls for second-brain-instance since May 2026.
- 30+ calls/day across 11 perspective types
- DeepInfra Qwen primary, OpenRouter fallback, Anthropic last resort
- Provider error rate monitored with auto-failover (R4 — in progress)
Documentation
docs/INTEGRATION.md— 5-min quick-startdocs/ARCHITECTURE.md— design, provider protocol, error handlingdocs/IMPLEMENTATION_PLAN.md— roadmap, tasks
Decision history:
Strategy:
docs/router-strategy-analysis.md— full strategic analysis: requirements, market, RICE prioritization, cost, cross-domain expansion
License
MIT © 2026 Eryk Orłowski
Built for second-brain-instance — now open to everyone.
Release files for exocortex-llm-router 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 | |
|---|---|---|---|
| exocortex_llm_router-0.1.1.tar.gz | 197.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exocortex_llm_router-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 218.9 kB
Release files / exocortex_llm_router-0.1.1.tar.gz
| Download URL | exocortex_llm_router-0.1.1.tar.gz |
|---|---|
| Size | 197.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f630492a7005b6cd729453a5520f17091f62959a70c4de0f9f41b500eb04003b
|
|
BLAKE2b-256 checksum How to use checksums |
347a2a1a34116497f09e291bd4e5e7d68e38775793bf899b69d09c442609e9b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency logRelease files / exocortex_llm_router-0.1.1-py3-none-any.whl
| Download URL | exocortex_llm_router-0.1.1-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bba058257f6ed8c78d95e396df78a791eb3d5883b6c2c8c121287305a482d93f
|
|
BLAKE2b-256 checksum How to use checksums |
b94bb8c01c884a72f288d789011c24234a0d2d436d709df160c72dcecd404635
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency log