Skip to main content

Build Status Coverage

llmbroker

Use multiple free LLM providers through one reliable API. llmbroker selects an available model, recovers from provider errors and rate limits, and learns which models work best for each task.

Start with no configuration file, paid subscription, or heavy orchestration framework. Add production storage, per-user keys, or a specific paid model only when you need them.

pip install llmbroker
llmbroker env freetier > .env   # required key names and links to obtain them
import llmbroker

broker = llmbroker.Broker()
reply = broker.ask("Explain decorators in one sentence")
print(reply.text)

Add any provider keys you have; models without keys are skipped automatically.

Resilient by default Automatically tries another model after rate limits and provider failures
Recovery without delays Rechecks a failed model alongside a working one; disable with parallel_recovery=False
Lower latency on demand fastest_of=2 queries multiple models and returns the first complete reply
Improves with feedback record_quality() adapts model selection independently for each operation
Complete application API Sync and async calls, streaming, chat, tools, and built-in tool loops
Direct premium access Broker(direct=["opus"]) calls a specific paid model through a stable alias
Ready to scale SQLite, PostgreSQL, MongoDB, shared journals, per-user keys, and pluggable secrets
Observable Pool state, call history, statistics, trace_id, and availability alerts

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

Metadata

Release files for llmbroker 1.10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llmbroker 1.10.3
File Size Uploaded
llmbroker-1.10.3.tar.gz 655.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llmbroker 1.10.3
File Interpreter ABI Platform
llmbroker-1.10.3-py3-none-any.whl Python 3 none any Details

Total release size: 795.3 kB

Release files / llmbroker-1.10.3.tar.gz

Download URL llmbroker-1.10.3.tar.gz
Size 655.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fe56db421ad79ab7861b27495dfde53ca63391fbcfcaec29885ee5468e62b61c
BLAKE2b-256 checksum
How to use checksums
9a12c5882c0da75b1ffa4492358df27970c3ea36fec70854af5cd984e5e92ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / llmbroker-1.10.3-py3-none-any.whl

Download URL llmbroker-1.10.3-py3-none-any.whl
Size 140.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
816a06b8277ede106afc2c84298e33ef9a31da34fde0bb44d5201ccd8ee6ef82
BLAKE2b-256 checksum
How to use checksums
82833dba2f999908daf7dc82019c23b9f212fda5093b66a93b8cf6cb2f04d9fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

1.11.0

2 release files

1.10.5

2 release files

This release

1.10.3 This release

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release 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