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.1.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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmsays-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 64940b447c3f396127b48ada761e944eb41a6f2bcd3b1f187dad96b8d6a941fc
MD5 f221fcc1fa0692951c199849d805ed0c
BLAKE2b-256 af994c2fb6bcc4be0cd7b3697f21cd3b65f4aca28f05e72b4c478b598c10ca92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmsays-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e0a9941b6e077c76badaa5267841f83b4fcef1a98bd7174fd99d66c92095ed8
MD5 2a4e05301a9121af99f660b07f48ff1e
BLAKE2b-256 f370344dc16e2c76382ea0bb62c0b4e8e773bca8d70f4447ce3b4c2eeaced3fb

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