Skip to main content

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. A 401/403 about one gated model ("the model X requires a subscription") rests only that model.
  • Empty replies, dead models, unreachable hosts. An empty answer or a connection failure/timeout rests the model 5 minutes; a 404 rests it a day. Retry-After is capped at one 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). At most max_parallel (default 2) requests are in flight, since each one spends a free-tier request.
  • 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 (each save merges what other processes wrote).
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))

free_llm_pool.chat() uses asyncio.run, so inside Jupyter or another running event loop use await Pool().chat(...) instead.

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-free-pool 0.1.1
File Size Uploaded Provenance Actions
llm_free_pool-0.1.1.tar.gz 19.0 kB With provenance Details for llm_free_pool-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-free-pool 0.1.1
File Interpreter ABI Platform Actions
llm_free_pool-0.1.1-py3-none-any.whl Python 3 none any Details for llm_free_pool-0.1.1-py3-none-any.whl

Total release size: 34.4 kB

Release files / llm_free_pool-0.1.1.tar.gz

Download URL llm_free_pool-0.1.1.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f79eda47c844eaf52b45177dae7e3c153e84716f257814e7c53b78be75cc3e48
BLAKE2b-256 checksum
How to use checksums
e9912a860f955bd0cd1b26772896a62f9679650082cd37fdd88035a081256dea
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 log

Release files / llm_free_pool-0.1.1-py3-none-any.whl

Download URL llm_free_pool-0.1.1-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47fed53b6addadab585afe3245630869eb3fa0f58b0ac4d83def24a585a565d7
BLAKE2b-256 checksum
How to use checksums
f3f54f5739fcc13f721ed52b5b2eff4d7279ef7b142b85239add55b6fbeede11
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 log

Security for llm-free-pool 0.1.1

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.

Select from 2 files

Attestation for llm_free_pool-0.1.1.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 log

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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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