Skip to main content

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_KEY
  • OPENROUTER_API_KEY
  • NIVIDIA_API_KEY
  • FIREWORKSAI_API_KEY
  • BASETEN_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"],
	)
)

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

  1. Heuristic pre-filter estimates complexity quickly.
  2. Semantic routing refines tier selection.
  3. Selected tier maps to provider-specific model choices.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmsays-0.1.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmsays-0.1.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file llmsays-0.1.2.tar.gz.

File metadata

  • Download URL: llmsays-0.1.2.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

Hashes for llmsays-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8fe51b4c547eadc7a0fc93275a591d959a5f507c1502496f6b10aec8173e7a27
MD5 f1e40aae1346e13e39ea39040e93b8fc
BLAKE2b-256 79e7e30f857107b4373167b95d2c8a7a7d514cd060657e58516a70aba379cf86

See more details on using hashes here.

File details

Details for the file llmsays-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llmsays-0.1.2-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

Hashes for llmsays-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd6a6adfcfe530aa93bab0b4bf4a82a8520bd892b150cd0516d009764db424a
MD5 4e92cf737fc6c1062959846e4ce272cf
BLAKE2b-256 f9431eb4ebf530bc79b1c3803e130e42d556b485dccef19c27a5891e7d051042

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page