llm-free-pool
One chat call across several free LLM tiers, built to survive their quirks.
Free tiers are generous but flaky: rate limits with different rules, models that disappear, trial credits that run out, replies that come back empty, and models that sit silent for 30 seconds. This small library hides that behind one call. It grew out of a personal AI that has run on free models around the clock on one home PC, where these quirks happen hundreds of times a day.
import free_llm_pool
answer = free_llm_pool.chat("Explain recursion in one sentence.")
print(answer.text, answer.provider, answer.model)
Install
pip install llm-free-pool
(The import name is free_llm_pool; the PyPI name differs because freellmpool was already taken.)
Then set the API keys for whichever free tiers you have (any subset works). The keys stay in your own environment;
the library sends each one only in its own provider's Authorization header and never writes it to disk.
| Provider | Environment variable |
|---|---|
| Groq | GROQ_API_KEY |
| Cerebras | CEREBRAS_API_KEY |
| Mistral | MISTRAL_API_KEY |
| NVIDIA (build.nvidia.com) | NVIDIA_API_KEY |
| Cohere | COHERE_API_KEY |
What it does on every call
- Strongest model first. Each provider's live model list is ranked by "prefer" words (e.g.
gpt-oss-120b,70b); speech, embedding and vision models are skipped. Weaker models are only a last resort. - Rate limits that respect the server. A 429 rests that model for exactly the server's
Retry-After(seconds or an HTTP date), or for a "try again in 7m12s" hint in the body. - Used-up free plans. A 402, or a 401/403/429 that says the trial, credits or subscription ran out, benches the whole provider for 1 day, then 2, 4 ... up to 30 days while it keeps happening. One real answer resets it.
- Empty replies and dead models. An empty answer rests the model 5 minutes; a 404 rests it a day.
- Too-large prompts. A "context too long" reply moves to the next model without punishing this one.
- Hedging. If the first model hasn't sent a single token after 6 seconds, the next one starts too, and whichever speaks first answers (the other is cancelled).
- Shared state. Pass
state_path=to keep cooldowns and benches in a JSON file, so restarts and several processes don't hammer a limited model.
import asyncio
from free_llm_pool import Pool
pool = Pool(state_path="pool_state.json", hedge_after=6.0)
answer = asyncio.run(pool.chat([{"role": "user", "content": "Hi"}], max_tokens=200))
Add your own OpenAI-compatible endpoint by passing providers=:
Pool(providers={"mylocal": {"base": "http://localhost:8080/v1", "prefer": ["qwen"]}})
Please use free tiers fairly
Free tiers exist at each provider's discretion. Follow their terms of use, use one account per provider, and don't use this to get around limits they set. It is built to respect rate limits, not dodge them. Some free tiers (e.g. NVIDIA's trial) may log prompts, so don't send anything private you wouldn't want stored.
Tests
python -m unittest discover -s tests -t . runs everything against local fake servers (no network, no keys):
rankings, Retry-After cooldowns, doubling plan benches, empty replies, too-large prompts and hedging.
License
Licensed under either of MIT or Apache License 2.0, at your option. Unless you say otherwise, any contribution you submit is dual-licensed the same way.
Also from the same experiment: evolve-guard, static checks that stop an LLM self-improvement loop from merging fake improvements.
Metadata
Release files for llm-free-pool 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_free_pool-0.1.0.tar.gz | 15.5 kB | With provenance | Details for llm_free_pool-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_free_pool-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llm_free_pool-0.1.0-py3-none-any.whl |
Total release size: 29.6 kB
Release files / llm_free_pool-0.1.0.tar.gz
| Download URL | llm_free_pool-0.1.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7e775fb15a74bd0a9496af33f6ae39a531591b911d72dc88cf94a98aaa511f9
|
|
BLAKE2b-256 checksum How to use checksums |
d8e594b00fc0fbd72a206aa85a34d9fe71aabf22843f267cc80d8082f937af79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / llm_free_pool-0.1.0-py3-none-any.whl
| Download URL | llm_free_pool-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14d73afab754074f60211376e18f5d745e4acd7f68daed2756d03666f1e11b8c
|
|
BLAKE2b-256 checksum How to use checksums |
07dcc067eb846fd83ea10376981b225694d23e8b45f2cb37d8d5a5fbd5e4c2b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for llm-free-pool 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for llm_free_pool-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.