Cycle through multiple LLM providers with smart fallback, load balancing, and unified API
Project description
LLMCycle ♻️
An enterprise-grade, highly resilient LLM management and routing framework. Designed to be better than LiteLLM with advanced multi-key support, customized routing (sort order), robust mid-stream error failovers, and a premium Web Dashboard.
🚀 Key Features
- 🔑 Universal Provider Support: Supports any provider on the market instantly. Just add
<PROVIDER_NAME>_API_KEYSto your.env! - ⚖️ Auto Load-Balancing: Load multiple API keys for the same provider simply by comma-separating them in your
.env. LLMCycle automatically round-robins across them and tracks rate limits locally. - 🛣️ Custom Fallback Routing: Configure custom routing. If a primary provider fails, it automatically falls back to your configured secondary.
- 🛡️ Streaming Time Resilience: If an LLM disconnects while streaming a response, LLMCycle captures the generated text, silently switches to your fallback model, and resumes the stream seamlessly. The client never notices!
- 🖥️ Premium Web Dashboard: Manage and view your keys, active providers, and fallback routes through a beautifully designed, secure UI.
📦 Installation
uv add llmcycle
uv add python-dotenv httpx fastapi uvicorn jinja2 python-multipart
⚙️ Configuration (.env)
Drop your keys into a .env file. To use multiple keys for load balancing, just separate them with commas!
DEEPSEEK_API_KEYS=sk-deepseek-1,sk-deepseek-2
OPENAI_API_KEYS=sk-openai-primary
TOGETHER_API_KEYS=sk-together-1
# You can even use completely custom providers!
# LLMCycle will default the base URL to https://api.mycustomai.com/v1
MYCUSTOMAI_API_KEYS=sk-custom
# Or explicitly define the base URL for custom providers
OLLAMA_API_KEYS=local
OLLAMA_BASE_URL=http://localhost:11434/v1
# UI Dashboard Auth
LLMCYCLE_USER_ADMIN=admin
LLMCYCLE_USER_ADMIN_PAASWORD=admin
🖥️ Starting the Web Dashboard
We built a gorgeous, premium Glassmorphism dashboard to monitor your providers.
# Make sure your PYTHONPATH is set if running from source:
# Windows: $env:PYTHONPATH="src"
# Linux/Mac: export PYTHONPATH="src"
uv run llmcycle ui
Navigate to http://127.0.0.1:8000 and login with the credentials defined in your .env!
💻 Usage: Everything in One!
import asyncio
from llmcycle import LLMCycle
async def main():
# 1. Initialization (Auto-loads all providers & keys from .env)
client = LLMCycle(
env_path=".env",
custom_fallbacks={
"deepseek": ["openai", "together"] # Sort order / Fallback chain
}
)
# 2. List all dynamically loaded providers
providers = client.get_available_providers()
print("Loaded Providers:", providers)
# 3. Query models supported by a provider
models = await client.get_provider_models("deepseek")
print("DeepSeek Models:", models)
if __name__ == "__main__":
asyncio.run(main())
🔌 Massive Universal Provider Registry
LLMCycle is pre-configured with base URLs for the most popular platforms:
OPENAI, DEEPSEEK, ANTHROPIC, TOGETHER, GROQ, MISTRAL, PERPLEXITY, ANYSCALE, FIREWORKS, COHERE, DATABRICKS, HUGGINGFACE.
Wildcard Support: If you type RANDOM_API_KEYS, LLMCycle will automatically assume https://api.random.com/v1. If that's wrong, just define RANDOM_BASE_URL in your .env!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmcycle-0.1.0.tar.gz.
File metadata
- Download URL: llmcycle-0.1.0.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4bbbfaf314eea6a2b193cffa733a838951d05f3c7b52601e46e9fcc3eaac94
|
|
| MD5 |
f5a5250192f1770cb55ba611efd68765
|
|
| BLAKE2b-256 |
ee3283ea4a896e47dc2a2b792249e37a15c4f3a406df3813115f317ca967439d
|
File details
Details for the file llmcycle-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmcycle-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e906f02934de3c46bd5cced63808a7c573d2cec2789a279f81d2fe97b2a31a7c
|
|
| MD5 |
9c88041a9a29117bbb93341beb5befdc
|
|
| BLAKE2b-256 |
272b38c6a382a116ae47b169f628ca7cdcd7514f54c31d16b6079faa58f666a6
|