Skip to main content

No project description provided

Project description

Build Status Coverage

llmbroker

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

Many free LLMs are unreliable and mediocre on their own. llmbroker pools them and routes across the pool, turning quantity into dependable, good-enough quality — without paying for a premium model.

No LangChain, no heavy deps.

llms = llmbroker.Broker("llms.toml")
print(llms.ask("Explain Python decorators in one sentence").text)

Put your LLMs in llms.toml — or grab a preset:

llmbroker preset freetier > llms.toml

The only setup is the API keys. Ask llmbroker which ones your pool needs — each with a note on where to get it, ordered easiest-and-most-valuable first:

llmbroker env llms.toml > .env

Running with only some of the keys is the normal, intended mode — add the keys that are easy and worth it, and the pool assembles itself from whatever is present. A missing key just means that one model stays inactive; it is not an error.

The same Broker scales straight to a server or cluster — add Redis or Postgres to share cooldown state across instances, the calling code stays the same.

Why llmbroker:

  • Automatic failover — when one LLM is rate-limited or down, the next one in the pool answers instead; you get a reply, not an error, as long as any LLM is up.
  • Chat, tools & agents — one-shot ask, multi-turn chat, and function/tool calling for agentic workflows.
  • Async-firstllmbroker.AsyncBroker built on asyncio for FastAPI, agents, and async workers; llmbroker.Broker wraps the same engine in a blocking API for plain scripts.
  • Pluggable backends — swap registry, state store, and telemetry independently: DB, Redis etc.
  • API keys configurable storage — environment variables, DB, AWS, Vault, your own store.
  • Multi-user mode -- optionally separate secrets and LLMs list for each application user.
  • Self-regulating pool — rate a reply's quality and llmbroker learns, per kind of task, which models are actually worth routing to; a consistently weak model quietly drops to the back of the queue instead of being nagged about by a human.

Documentation

llmbroker

Developers

Do not forget to run . ./activate.sh.

For work it need uv installed.

Use pre-commit hooks for code quality:

pre-commit install

Allure test report

Scripts

Install invoke preferably with uv tool:

uv tool install invoke

For a list of available scripts run:

invoke --list

For more information about a script run:

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 (presets/freetier-refresh-prompt.md).

Coverage report

Created with cookiecutter using template

Project details


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.1.0.tar.gz (267.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.1.0-py3-none-any.whl (78.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmbroker-1.1.0.tar.gz
  • Upload date:
  • Size: 267.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmbroker-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1c2ce897bc46444c69dea7d9dcd2d6790b8ba529334ba119569681fec5d6475b
MD5 78bfdd752c5fb4ec4841af141cc399eb
BLAKE2b-256 fe24aa70798c88c03192ea06a25ec6f067581381d37330eb0372e48a4e4b454e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmbroker-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmbroker-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f19467b798e1b141196d87c9958950d4d396b4bced7563200c2057bdd73fb55b
MD5 0b156693bf65cf2fbf61b4f2cfba886f
BLAKE2b-256 a3ccb1b8c5cb10db2312aeec3275de50b267df38a7552fbaeafb6a181ecfb2ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page