Skip to main content

llmf

Free, keyless LLM access in one call — with automatic multi-provider fallback.

PyPI version Python versions License: MIT

llmf (llmfree) is a stdlib-only Python library and CLI for public, no-API-key OpenAI-compatible endpoints. It picks a live target, falls back on errors, and runs on desktop and Termux.

import llmf

r = llmf.chat("Explain the CAP theorem in two sentences.")
print(r)              # Reply is a str subclass
print(r.source)       # "provider/model"
print(r.provider, r.model, round(r.latency, 3), r.usage)

Package metadata (pip show llmf)

Name: llmf
Version: 0.5.1
Summary: llmf (llmfree): free, keyless LLM chat with automatic multi-provider fallback — stdlib only.
Home-page: https://github.com/MoonLite-Br/llmfree
Author: Html
Author-email: moonlite-br@users.noreply.github.com
License: MIT
Requires-Python: >=3.8
Requires:
Field Value
Name llmf
Version 0.5.1
Dependencies none
License MIT
Repository https://github.com/MoonLite-Br/llmfree
PyPI https://pypi.org/project/llmf/
pip install -U llmf
pip show llmf

Install

pip install -U llmf
python -c "import llmf; print(llmf.__version__)"
llmf version

Python API

Short form → Reply

import llmf

r = llmf.chat("Hello!")
assert isinstance(r, str)
r.text                 # same as str(r)
r.source               # "provider/model"
r.provider, r.model
r.latency              # seconds
r.usage                # dict or None
r.finish_reason
r.reasoning            # optional
r.attempts             # list of Attempt(provider, model, ok, latency, error)

model= aliases: fast | best | code | vision | reasoning
Also fuzzy names, full provider/id, a list tried in order, or provider="…".

llmf.chat("hi", model="code", max_tokens=256, temperature=0.3)
llmf.chat("hi", model=["best", "fast"])
llmf.chat("Describe this", images=["photo.jpg"], model="vision")  # vision_timeout default 90s
llmf.chat("…", provider="ch-at")       # force provider (works for opt-in too)
llmf.chat("…", provider="nottrack")    # opt-in provider (not in auto chain)

for piece in llmf.stream("Count 1 to 5"):
    print(piece, end="", flush=True)

OpenAI-shaped form

from llmf import LLMF

llm = LLMF()
c = llm.chat.completions.create(
    model="best",
    messages=[{"role": "user", "content": "Hello"}],
)
print(c.choices[0].message.content)
print(c.model, c.provider, c.usage, c.latency, c.attempts)

for chunk in llm.chat.completions.create(
    model="fast",
    messages=[{"role": "user", "content": "Count to 3"}],
    stream=True,
):
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="")

Catalog, doctor, config

llmf.models.list()
llmf.models.list(live=True)                              # chat/free only by default
llmf.models.list(live=True, include_non_chat=True)
llmf.models.resolve("best")
llmf.models.check()                                      # real call per model; ~24h cache
llmf.providers.list()
llmf.health.check()

llmf.configure(timeout=30, vision_timeout=90, routing="adaptive", race=2)
llmf.register("lab", "http://localhost:11434/v1", ["llama3"], front=True)
llmf.discover()                                          # opt-in external catalog

Env: LLMF_TIMEOUT, LLMF_PROXY, LLMF_MODEL, LLMF_ROUTING.
Proxy: http://, https://, socks5://, socks5h://, socks4:// (stdlib).


CLI

usage: llmf [options] "question"              ask once (also reads stdin)
       llmf chat                              interactive chat (/reset, /exit)
       llmf models [list|check|resolve NAME]
       llmf doctor [--all] [--include-non-chat] [--include-limited]
       llmf providers | health
       llmf serve [--port N]
       llmf version
Command Description
llmf "…" / llmf ask "…" One-shot ask
llmf chat Interactive REPL
llmf models / models list Catalog table
llmf models list --live + live /models (chat/free by default)
llmf models list --live --include-non-chat Include non-chat ids
llmf models resolve best Expand alias
llmf models check / llmf doctor Probe models once
llmf doctor --all Also live-discovered ids
llmf doctor --include-limited Strict daily-quota providers
llmf doctor --include-non-chat Non-chat model ids
llmf doctor --no-save Skip health cache write
llmf providers Provider table
llmf health Quick OK/FAIL ping
llmf serve Local OpenAI-compatible server
llmf version Print version

Flags: -m/--model, -p/--provider, -s/--system, -i/--interactive, --image, --max-tokens, -t/--temperature, --stream, --json, -v, --routing ranked|adaptive, --race N, --timeout, --proxy, --live, --all, --include-limited, --include-non-chat, --no-save, --host, --port, --api-key, --cors, --strict-models, --no-fallback.

$ llmf "Say hi in one short sentence."
$ llmf -v "2+2=?"
$ llmf --json "Say hi in one short sentence."
$ llmf models
$ llmf models resolve fast
$ llmf doctor
$ llmf serve --port 8000

What’s new in 0.5.0

  • Providers: ch-at (early in chain / best), rewind-ai (Qwen / gpt-4o-mini; sign-in-only marked broken), nottrack (SSE debate adapter — opt-in only, not in automatic fallback; use provider="nottrack").
  • ProviderSpec.auto=False: stays out of the auto chain, still usable with provider=.
  • BlockRun / Pollinations catalogue tweaks (openai-fast ≡ openai).

Earlier (0.4.x): smarter 429 classes, chat/free-only live catalog by default, dynamic fast tag, vision_timeout, Retry-After scaling — see CHANGELOG.md.


Behaviour notes

  • Fallback prefers faster/cleaner targets; failures get cooldowns (rate-limit / capacity / paid messages differ).
  • routing="adaptive" uses latency EWMA; race=N hedges parallel requests.
  • doctor / models.check() results cached ~24h.
  • Total failure → llmf.AllProvidersFailed with .errors.

Safety

  • Endpoints are unofficial and free; they may change or vanish.
  • Do not send secrets or personal data.
  • Opt-in providers (nottrack) and discover() are explicit.
  • llmf serve defaults to localhost, no CORS, unless you pass --cors / --api-key.

Development

git clone https://github.com/MoonLite-Br/llmfree.git
cd llmfree
python -m unittest discover -s tests -v
python -m build && twine check dist/*

License

MIT © 2026 Html / MoonLite-Br

Metadata

Release files for llmf 0.5.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 llmf 0.5.1
File Size Uploaded Provenance
llmf-0.5.1.tar.gz 58.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 112.9 kB

Release files / llmf-0.5.1.tar.gz

Download URL llmf-0.5.1.tar.gz
Size 58.9 kB
Tags Source
SHA-256 checksum
How to use checksums
acdb896789fa6cdaf61a132302d28f5ba1b6ec4f947a8433b3095706d251692e
BLAKE2b-256 checksum
How to use checksums
a06bb4208deb367413552e7baa90cd21e2145bf106d8f462f56c48db30120026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / llmf-0.5.1-py3-none-any.whl

Download URL llmf-0.5.1-py3-none-any.whl
Size 53.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85ca43a2eafa86ef643ba585620a4105f9c50c61585c3bfa83942fb108d2401b
BLAKE2b-256 checksum
How to use checksums
ab3bf649690eaa8be4b102e08b50019ac9f9ffd09da26715606569b81954c387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for llmf 0.5.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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