Skip to main content

🔀 llm-failover-router

Resilient Multi-Provider LLM Fallback Router for High-Availability AI Applications.

PyPI License: MIT


📌 Why llm-failover-router?

When LLM APIs experience outages, rate-limits (HTTP 429), or network timeouts, your application crashes or hangs.

llm-failover-router provides a zero-overhead, multi-provider fallback strategy: If Provider A (e.g., DeepSeek) fails or times out, it seamlessly switches to Provider B (OpenAI) or Provider C (Local Ollama) in milliseconds!


⚡ Quick Start

pip install llm-failover-router

Usage Example:

from llm_failover_router import LLMRouter, ProviderConfig

# Configure providers with priority order
router = LLMRouter(
    providers=[
        ProviderConfig(name="deepseek", api_key="sk-...", model="deepseek-chat"),
        ProviderConfig(name="openai", api_key="sk-...", model="gpt-4o-mini"),
        ProviderConfig(name="ollama", endpoint="http://localhost:11434", model="llama3"),
    ],
    timeout_seconds=5.0
)

# Executes primary provider; automatically falls back if API fails!
response = router.generate("Explain quantum computing in simple terms.")
print(f"Provider Used: {response.provider_used}")
print(f"Content: {response.content}")

👤 Author

Mohamed Shaban (محمد شعبان العتماني) — Applied AI Engineer
🌐 Website: msalatmani.org | 📧 Email: msalatmani@gmail.com

Metadata

Release files for llm-failover-router 0.1.0

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

Source distribution (sdist)

Source distribution for llm-failover-router 0.1.0
File Size Uploaded
llm_failover_router-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-failover-router 0.1.0
File Interpreter ABI Platform
llm_failover_router-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / llm_failover_router-0.1.0.tar.gz

Download URL llm_failover_router-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aff96fe03bd8179816448f1e435bcd1ff7425d2e4335af0e7ed86f8732400b70
BLAKE2b-256 checksum
How to use checksums
34db456ea95c3e0868b279a6074cf574b801ac241a5e3a401da8be5cf6fd51d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / llm_failover_router-0.1.0-py3-none-any.whl

Download URL llm_failover_router-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3686c85e6b5a5e46298063c09892d1f8cdc86486738fbadacb52c0e1cfe5905a
BLAKE2b-256 checksum
How to use checksums
6f62fca277b27193d5ee6fb28f652e78aec2eb6358f4508e144c7c207ef67e94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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