One-line LLM queries with smart routing and provider failover
Project description
llmsays
One-line LLM calls with automatic prompt-tier routing and provider failover.
llmsays keeps usage simple:
from llmsays import llmsays
response = llmsays("Explain quantum tunneling in simple words")
print(response)
Why llmsays
- Single function API:
llmsays(prompt) - Smart routing with
sentence-transformers/paraphrase-MiniLM-L3-v2 - Tier selection:
small,medium,large,extra_large - Provider failover: Groq, NIM, OpenRouter, Fireworks, Baseten
- Latency-aware provider ordering
- Optional parallel provider querying for faster first-response
Installation
pip install llmsays
Required Environment Variables
Set at least one provider key (multiple keys recommended for failover):
GROQ_API_KEYOPENROUTER_API_KEYNVIDIA_API_KEYFIREWORKSAI_API_KEYBASETEN_API_KEY
Example:
export GROQ_API_KEY="your_key"
export OPENROUTER_API_KEY="your_key"
Quick Start
from llmsays import llmsays
user_prompt = input("Here goes your prompt: ")
print(llmsays(user_prompt))
Advanced Usage
Choose provider order:
from llmsays import llmsays
print(
llmsays(
"Analyze this legal clause",
provider_preference=["Groq", "Openrouter", "fireworks-ai"],
)
)
Enable parallel provider queries (returns first successful response):
from llmsays import llmsays
print(
llmsays(
"Design a production-ready architecture with tradeoffs",
use_multiprocessing=True,
)
)
CLI Usage
llmsays "Explain transformers in simple terms"
llmsays "Analyze this legal clause" --providers Groq Openrouter
llmsays "Summarize this API contract" --use-multiprocessing
How Routing Works
- Heuristic pre-filter estimates complexity quickly.
- Semantic routing refines tier selection.
- Selected tier maps to provider-specific model choices.
- If one provider fails, the next provider is attempted automatically.
Notes
- Requires Python
>=3.9 - Internet connection is required to call provider APIs
- Responses depend on the configured provider/model availability
License
MIT
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 llmsays-0.1.3.tar.gz.
File metadata
- Download URL: llmsays-0.1.3.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc751c6c68f601684f0b274b8472e8a2d4f2ff0ff784fa09aed676b3b828359b
|
|
| MD5 |
46aa41cbb1d7be60f5bdfabc7bcf7281
|
|
| BLAKE2b-256 |
13cf26e423d185238ed5fea2cfba51476da76096697bcd0bd39112142402b751
|
File details
Details for the file llmsays-0.1.3-py3-none-any.whl.
File metadata
- Download URL: llmsays-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ac25cdec163e61d2ce0a116b411261eb34a9e97bcf388b1f5706a0b09a3f3ca
|
|
| MD5 |
50f5d6164f79a8b8ce90011a9af0773a
|
|
| BLAKE2b-256 |
6723dfca7e4d5297c5096843b9c62b79f16020ecd5c7d825e7c0bce005a1b36e
|