Skip to main content

Build Status Coverage

llmbroker

Turn a crowd of free, rate-limited LLMs into one reliable model — no premium subscription, no single point of failure. No LangChain, no heavy deps.

pip install llmbroker
llmbroker env freetier > .env   # which API keys to get, and where
llms = llmbroker.Broker()       # no config file: the curated pool of free models
reply = llms.ask("Explain decorators in one sentence")
print(reply.text)   # groq rate-limited? gemini answers instead

Fill in whichever keys are easy — models without keys just stay inactive.

Why another router? LiteLLM or OpenRouter forward your request and hand back the error; llmbroker runs the pool for you: backs off on rate limits and retries with the next model inside the same call, disables dead keys on its own, and learns which models are weak at which tasks. Set it up once, never administer it.

Automatic failover llms.ask(...) — next model answers when one is down
Chat, tools & agents llms.chat(messages, tools=...), run_tool_loop(...)
Async-first AsyncBroker — same engine, for FastAPI / agents / workers
Scale out Broker("postgresql://…") — sqlite / Postgres / MongoDB, calling code unchanged
Self-regulating pool reply.record_quality(0.3) — weak models sink per task kind; rate later with llms.record_quality(...)
Pluggable secrets env vars, DB, AWS, Vault, or your own backend
Multi-user mode per-user API keys on top of one shared pool

Documentation

Development

Do not forget to run . ./activate.sh. It needs uv installed.

Use pre-commit hooks for code quality:

pre-commit install

Install invoke preferably with uv tool:

uv tool install invoke

For a list of available scripts run invoke --list; for details on one, invoke <script> --help.

The bundled freetier preset drifts as providers change their free tiers; refresh it with invoke catalog-refresh, which prints the maintenance runbook (src/llmbroker/presets/freetier-refresh-prompt.md).

Reports:

Created with cookiecutter using template

Download files

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

Source Distribution

llmbroker-1.5.0.tar.gz (472.0 kB view details)

Uploaded Source

Built Distribution

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

llmbroker-1.5.0-py3-none-any.whl (119.2 kB view details)

Uploaded Python 3

File details

Details for the file llmbroker-1.5.0.tar.gz.

File metadata

  • Download URL: llmbroker-1.5.0.tar.gz
  • Upload date:
  • Size: 472.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmbroker-1.5.0.tar.gz
Algorithm Hash digest
SHA256 ff9ad0b8eb2068f212065fd938b0feebb31e3b0b7cce1345383e4c2b121f2630
MD5 be7da9c72b6e21070c52f6a533f4565c
BLAKE2b-256 490a7d89a5b1b3bf45028df4446779899fae676c35c51a4b92bf398e519417d2

See more details on using hashes here.

File details

Details for the file llmbroker-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: llmbroker-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 119.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmbroker-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d4426a04b32fa32992f7649a1006dd98e061c99702b284427ee9394de2e9690
MD5 ab1a8a4d1e8f9eece7aee2980aafdcdf
BLAKE2b-256 0326f95dbdcfa09faad6b273f139969b6e110b8914ef7d1b6d5e49fb2a64cb0e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.7.0

2 files

1.6.0

2 files

1.5.2

2 files

1.5.1

2 files

This release

1.5.0 This release

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page