Skip to main content

tollfree (Python)

One chat() call over free-tier LLM providers, with automatic failover: rotate a provider's models first, then fall over to the next provider.

Keys are read straight from .env. Missing keys are skipped automatically — you only need one to start.

Install

pip install tollfree     # or: uv add tollfree

Use

from tollfree import chat

reply = chat("Explain the CAP theorem in two sentences.")

# with metadata about which provider/model actually answered:
reply, meta = chat("hi", return_meta=True, temperature=0.2)
# meta -> {'provider': 'google', 'model': 'gemini-3.6-flash'}

CLI:

tollfree "your prompt here"   # chat
tollfree probe                # verify keys + limits, spends no completion tokens

Failover logic

for provider in PROVIDERS:          # priority order (providers.json)
  for model in provider.models:     # default = first
    try  -> return on success
    401/403             -> skip whole provider (bad key)
    429/404/5xx/timeout -> next model, then next provider
raise AllProvidersFailed            # only when everything is exhausted

Configuration

Set keys in .env (or the environment):

GROQ_API_KEY=
CEREBRAS_API_KEY=
GEMINI_API_KEY=
OPENROUTER_API_KEY=
MISTRAL_API_KEY=
ZAI_API_KEY=

The provider/model registry is providers.json, kept in sync from the central repo which is the source of truth for both the Python and npm packages.

Metadata

Release files for tollfree 0.1.0

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

Source distribution (sdist)

Source distribution for tollfree 0.1.0
File Size Uploaded Provenance Actions
tollfree-0.1.0.tar.gz 5.2 kB With provenance Details for tollfree-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.5 kB

Release files / tollfree-0.1.0.tar.gz

Download URL tollfree-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4f3f433fc4418d88942c7c87c15a7a6d3c6bdb8bd5a23283c69c808cc660a6ed
BLAKE2b-256 checksum
How to use checksums
b9916e7dda6ef50500d51362c74f2d2394691b3aa2327e88465a8f91106f55c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

Release files / tollfree-0.1.0-py3-none-any.whl

Download URL tollfree-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73d6fb11cbf121e6345c6864affab7f4fffa31ae9d5ebf9821a28cfc11a73a86
BLAKE2b-256 checksum
How to use checksums
6409de6602f8807a2d69335ddb801f091920591a4d8a6416c84f685cdc4b807b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

Security for tollfree 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.

Select from 2 files

Attestation for tollfree-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 Aug 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.0 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