Skip to content

llmbroker

llmbroker presents several free language models through one interface. If one model is unavailable or rate-limited, the broker tries another. It requires no paid subscription or large dependency such as LangChain.

Quick start

Install llmbroker. Free models require provider API keys. This command creates a .env template and tells you where to obtain each key:

llmbroker env freetier > .env

Add at least one key, then create a broker and send a request:

import llmbroker

broker = llmbroker.Broker()
print(broker.ask("Hello, how are you?").text)

No separate configuration file is required. Broker() loads the maintained list of free models, reads keys from environment variables and .env in the working directory, and updates the list automatically.

A model without a key is simply not used. If a provider rate-limits a request, the broker tries the next available model. It returns an error only when no model can answer.

What it can do