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.9.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.9.0
File Size Uploaded
llmbroker-1.9.0.tar.gz 615.1 kB Details

Built distribution (wheel)

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

Total release size: 752.3 kB

Release files / llmbroker-1.9.0.tar.gz

Download URL llmbroker-1.9.0.tar.gz
Size 615.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9e027487fcc9e932ebb2f389c9cacba9199d799ceef93ddaf2fff762811d4994
BLAKE2b-256 checksum
How to use checksums
81299bb2ab50fbf6a982cefb5392bbcf5e9433552aa6e8450d0dae5004c9a341
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.9.0-py3-none-any.whl

Download URL llmbroker-1.9.0-py3-none-any.whl
Size 137.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8731880fbfa63ff875f7e50051523209652e17e3482654b4672437fcfe23a7be
BLAKE2b-256 checksum
How to use checksums
c56073b35539df5af82568c6515c5c9682aa721265fe66dcc74af2ea0fffb248
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

1.10.0

2 release files

This release

1.9.0 This release

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