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.0

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.0
File Size Uploaded
llmbroker-1.10.0.tar.gz 626.2 kB Details

Built distribution (wheel)

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

Total release size: 764.6 kB

Release files / llmbroker-1.10.0.tar.gz

Download URL llmbroker-1.10.0.tar.gz
Size 626.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ba071a36e51b14c4c4cefb4186ce64fba39f9e6c86cd8c6af2bf37b081b47825
BLAKE2b-256 checksum
How to use checksums
3a3db2cf442407c7272245047958038d078da56481b3cf0e550842cabee20ce7
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.0-py3-none-any.whl

Download URL llmbroker-1.10.0-py3-none-any.whl
Size 138.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e84b68d58547574145723a607929772d06e0729eb057461c4e75e8a6d3ad573
BLAKE2b-256 checksum
How to use checksums
c579ba81b187428d92ea176d6e78946c5fe01a19d60d831001e56879600a2c51
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

1.10.3

2 release files

This release

1.10.0 This release

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