Production-focused Python library for intelligent LLM routing and multi-provider management
Project description
JustLLMs
A production-ready Python library focused on intelligent LLM routing and multi-provider management.
Why JustLLMs?
Managing multiple LLM providers is complex. You need to handle different APIs, optimize costs, and ensure reliability. JustLLMs solves these challenges by providing a unified interface that automatically routes requests to the best provider based on your criteriaโwhether that's cost, speed, or quality.
Installation
pip install justllms
Package size: ~113KB | Lines of code: ~4.3K | Dependencies: Production-focused
Quick Start
from justllms import JustLLM
# Initialize with your API keys
client = JustLLM({
"providers": {
"openai": {"api_key": "your-openai-key"},
"google": {"api_key": "your-google-key"},
"anthropic": {"api_key": "your-anthropic-key"}
}
})
# Simple completion - automatically routes to best provider
response = client.completion.create(
messages=[{"role": "user", "content": "Explain quantum computing briefly"}]
)
print(response.content)
Core Features
Multi-Provider Support
Connect to all major LLM providers with a single, consistent interface:
- OpenAI (GPT-5, GPT-4, etc.)
- Google (Gemini 2.5, Gemini 1.5 models)
- Anthropic (Claude 4, Claude 3.5 models)
- Azure OpenAI (with deployment mapping)
- xAI Grok, DeepSeek
- Ollama (local Llama/Mistral/phi models hosted on your machine)
# Switch between providers seamlessly
client = JustLLM({
"providers": {
"openai": {"api_key": "your-key"},
"google": {"api_key": "your-key"},
"anthropic": {"api_key": "your-key"},
"ollama": {"base_url": "http://localhost:11434"}
}
})
# Same interface, different providers automatically chosen
response1 = client.completion.create(
messages=[{"role": "user", "content": "Explain AI"}],
provider="openai", # Force specific provider
model="gpt-5"
)
Ollama runs locally and requires no API key. Set OLLAMA_API_BASE (defaults to
http://localhost:11434) and JustLLMs automatically discovers every installed
model via the Ollama /api/tags endpoint.
Intelligent Routing
The game-changing feature that sets JustLLMs apart. Instead of manually choosing models, let our intelligent routing engine automatically select the optimal provider and model for each request based on your priorities.
Available Strategies
๐ Cluster-Based Routing - AI-Powered Query Analysis Our most advanced routing strategy uses machine learning to analyze query semantics and route to the optimal model based on similarity to training data. Achieves +7% accuracy improvement and -27% cost reduction compared to single-model approaches.
# Cluster-based routing (recommended for production)
client = JustLLM({
"providers": {...},
"routing": {"strategy": "cluster"}
})
Based on research from Beyond GPT-5: Making LLMs Cheaper and Better via PerformanceโEfficiency Optimized Routing - AvengersPro framework
How Cluster Routing Works
- Query Analysis: Your request is embedded using Qwen3-Embedding-0.6B
- Cluster Matching: Finds the most similar cluster from pre-trained data
- Model Selection: Routes to the best-performing model for that cluster
- Fallback: Falls back to quality-based routing if needed
Result: Up to 60% cost reduction while improving accuracy, with automatic failover to backup providers.
Side-by-Side Model Comparison
Compare multiple LLM providers and models simultaneously with our interactive SXS (Side-by-Side) comparison tool. Perfect for evaluating model performance, testing prompts, and making informed decisions about which models to use.
Features
- Interactive CLI: Select providers and models using checkbox interface
- Parallel Execution: All models run simultaneously for fair comparison
- Real-time Results: Live display with loading animation until all models complete
- Comprehensive Metrics: Compare latency, token usage, response quality and costs across models
- Multiple Providers: Test OpenAI, Google, Anthropic, xAI, DeepSeek models side-by-side
Usage
# Run the interactive SXS comparison
justllms sxs
The tool will guide you through:
- Provider Selection: Choose which LLM providers to compare
- Model Selection: Pick specific models from each provider
- Prompt Input: Enter your test prompt
- Real-time Comparison: View all responses and metrics simultaneously
Example Output
================================================================================
Prompt: Which programming language is better for beginners: Python or JavaScript?
================================================================================
โโ openai/gpt-5 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Python is generally better for beginners due to its clean, readable syntax โ
โ that resembles natural language. It has fewer confusing concepts like โ
โ hoisting or prototypes, excellent learning resources, and is widely used โ
โ in education. Python's "batteries included" philosophy means beginners can โ
โ accomplish tasks without learning complex setups, making it ideal for โ
โ building confidence early in programming. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ google/gemini-2.5-pro โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ JavaScript has advantages for beginners because it runs everywhere - in โ
โ browsers, servers, and mobile apps. You can see immediate visual results โ
โ when building web pages, which is motivating. The job market heavily favors โ
โ JavaScript developers, and modern frameworks make it powerful. While syntax โ
โ can be tricky, the instant feedback and versatility make JavaScript a โ
โ practical first language for aspiring developers. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
================================================================================
Metrics Summary:
| Model | Status | Latency (s) | Tokens | Cost ($) |
|-------------------------|-----------|-------------|--------|----------|
| openai/gpt-5 | โ Success | 5.69 | 715 | 0.0000 |
| google/gemini-2.5-pro | โ Success | 8.50 | 868 | 0.0003 |
๐ Comparison with Alternatives
| Feature | JustLLMs | LangChain | LiteLLM | OpenAI SDK |
|---|---|---|---|---|
| Package Size | Minimal | ~50MB | ~5MB | ~1MB |
| Setup Complexity | Simple config | Complex chains | Medium | Simple |
| Multi-Provider | โ 7+ providers | โ Many integrations | โ 100+ providers | โ OpenAI only |
| Intelligent Routing | โ Cost/speed/quality/cluster | โ Manual only | โ ๏ธ Basic routing | โ None |
| Side-by-Side Comparison | โ Interactive CLI tool | โ None | โ None | โ None |
| Cost Optimization | โ Automatic routing | โ Manual optimization | โ ๏ธ Basic cost tracking | โ None |
| Production Ready | โ Out of the box | โ ๏ธ Requires setup | โ Minimal setup | โ ๏ธ Basic features |
Production Configuration
For production deployments:
production_config = {
"providers": {
"azure_openai": {
"api_key": os.getenv("AZURE_OPENAI_KEY"),
"endpoint": os.getenv("AZURE_OPENAI_ENDPOINT"),
"resource_name": "my-enterprise-resource",
"deployment_mapping": {
"gpt-4": "my-gpt4-deployment",
"gpt-3.5-turbo": "my-gpt35-deployment"
}
},
"anthropic": {"api_key": os.getenv("ANTHROPIC_KEY")},
"google": {"api_key": os.getenv("GOOGLE_KEY")},
"ollama": {
"base_url": os.getenv("OLLAMA_API_BASE", "http://localhost:11434"),
"enabled": True,
}
},
"routing": {
"strategy": "cluster", # Use intelligent cluster-based routing
"fallback_provider": "azure_openai",
"fallback_model": "gpt-3.5-turbo"
}
}
client = JustLLM(production_config)
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 justllms-2.0.2.tar.gz.
File metadata
- Download URL: justllms-2.0.2.tar.gz
- Upload date:
- Size: 118.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
811f007b5b2802ac2700e961f12595e6d778f189fc976ab78d86dfd5b0847fc9
|
|
| MD5 |
59417069a997b78c056c7874a43e3e2b
|
|
| BLAKE2b-256 |
0209a8e07d2344cf0408f20a11819c060c5ed9c4b19eb58b314453dc1c6ff6fd
|
File details
Details for the file justllms-2.0.2-py3-none-any.whl.
File metadata
- Download URL: justllms-2.0.2-py3-none-any.whl
- Upload date:
- Size: 125.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1d8626f988b77a24854fec432742690259f7d169f19f2debb780cb3cefd8dda
|
|
| MD5 |
67b91f2274a60d88839d8bcfb0c9fa21
|
|
| BLAKE2b-256 |
6e19bdf8c3ad372f50124e6a1de01818634aa4fcb3c28bd280ac550caece92c2
|