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

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.5
File Size Uploaded
llmbroker-1.10.5.tar.gz 661.1 kB Details

Built distribution (wheel)

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

Total release size: 803.0 kB

Release files / llmbroker-1.10.5.tar.gz

Download URL llmbroker-1.10.5.tar.gz
Size 661.1 kB
Tags Source
SHA-256 checksum
How to use checksums
83a8fca847a536aeaab6b0dc25e1f91768a14da239f08fb8519849ab47d05f0c
BLAKE2b-256 checksum
How to use checksums
4325e7955ef56ce85f4fb1f78d03cc5c5fa29d2ad6e462d9a20b349851819621
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.5-py3-none-any.whl

Download URL llmbroker-1.10.5-py3-none-any.whl
Size 142.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bd8a0c580ec3405502e76b1330b4ac72ac1d50ce2a7a9a3b838f54c85ce3585
BLAKE2b-256 checksum
How to use checksums
bbdee1156110be607c2cb972ccb1475e1b53acaff456d1d16fe70559a47d5fa2
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

This release

1.10.5 This release

2 release files

1.10.3

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