Skip to main content

llmf

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

PyPI version Python versions License: MIT PyPI downloads

llmf (llmfree) is a tiny Python library and CLI that talks to public, no-API-key OpenAI-compatible endpoints. It picks a working provider, falls back when one fails, and needs zero third-party dependencies (stdlib only). Runs on Linux, macOS, Windows, and Termux.

import llmf

print(llmf.chat("Explain the CAP theorem in two sentences."))

No signup. No keys. Same Reply / OpenAI-shaped objects every time.


Package info (pip show llmf)

Field Value
Name llmf
Version 0.3.0
Summary Free, keyless LLM chat with automatic multi-provider fallback — stdlib only
Author Html
License MIT
Requires-Python >=3.8
Dependencies none
Home-page https://github.com/MoonLite-Br/llmfree
PyPI https://pypi.org/project/llmf/
pip show llmf
pip show -f llmf    # list installed files

Install

pip install -U llmf

Verify:

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

Quick start

Simple API

import llmf

llmf.chat("Hello!")
llmf.chat("Write fibonacci in Python", model="code")
llmf.chat("hi", model="fast")          # aliases: fast | best | code | vision | reasoning
llmf.chat("hi", model="llama")         # fuzzy name
llmf.chat("hi", model="ovh/Meta-Llama-3.3-70B-Instruct")
llmf.chat("hi", model=["best", "fast"])

llmf.chat(
    "Return JSON with keys name and age",
    system="Only valid JSON",
    max_tokens=256,
    temperature=0.2,
    json=True,
)

llmf.chat("Describe this", images=["photo.jpg"], model="vision")

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

chat() returns a Reply: acts like a str, plus provider/model/attempt metadata.

OpenAI-shaped API (0.3+)

from llmf import LLMF

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

# Streaming
for event in llm.chat.completions.create(model="fast", messages=[...], stream=True):
    ...

Module helpers still work: llmf.chat(...), llmf.models(), llmf.providers(), llmf.health().

llmf.models.list()
llmf.models.check()       # doctor: real call per model (cached ~24h)
llmf.models.resolve("fast")
llmf.providers.list()
llmf.health.check()

CLI

llmf "Your question"                 # one-shot ask
llmf ask "..." -m best --stream
llmf chat                            # interactive (/reset, /exit)
llmf models                          # catalog
llmf models list
llmf models resolve fast
llmf models check                    # live probe + health cache
llmf doctor [--all] [--include-limited]
llmf providers
llmf health
llmf serve [--port 8000] [--api-key SECRET]
llmf version

Useful flags: -m/--model, -p/--provider, -s/--system, --image, --max-tokens, -t/--temperature, --stream, --json, --routing ranked|adaptive, --race N, --proxy URL.

Local OpenAI-compatible server (default 127.0.0.1, no CORS):

llmf serve --port 8000
curl http://127.0.0.1:8000/v1/models

Bind 0.0.0.0 only together with --api-key.


Configuration

Mechanism Examples
Code llmf.configure(timeout=30, exclude=["blockrun"], routing="adaptive", race=2)
Env LLMF_TIMEOUT, LLMF_PROXY, LLMF_MODEL, LLMF_ROUTING
Proxy HTTP(S) or SOCKS4/4a/5/5h (stdlib): proxy="socks5h://127.0.0.1:9050"
Custom endpoint llmf.register("lab", "http://localhost:11434/v1", ["llama3"], front=True)
Discovery llmf.discover() — opt-in scan for extra keyless bases

Isolated client (no shared state):

from llmf import Client
c = Client(timeout=20, routing="adaptive")
c.chat("hi")

How it works

  1. Build a fallback plan from aliases, explicit ids, and provider health.
  2. Prefer fast/clean targets; cool down failures (longer on HTTP 429).
  3. Optional routing="adaptive" uses latency EWMA; race=N hedges parallel requests.
  4. doctor / models.check() results are cached (~24h) to demote dead models.
  5. Strip thinking/stats noise; treat empty “HTTP 200” bodies as failures.
  6. If everything fails → llmf.AllProvidersFailed with .errors per provider.

Public free endpoints change often — use llmf health and llmf doctor to see what still works.


Safety

  • Endpoints are unofficial and free. They may rate-limit, change, or vanish.
  • Do not send secrets, passwords, or personal data to third-party servers.
  • discover() contacts external catalogs; treat as opt-in.
  • Default llmf serve listens on localhost only.

Source https://github.com/MoonLite-Br/llmfree
Issues https://github.com/MoonLite-Br/llmfree/issues
Changelog CHANGELOG.md
PyPI https://pypi.org/project/llmf/
License MIT

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/*

Supported Python: 3.8–3.13.


License

MIT © 2026 Html / MoonLite-Br

Metadata

Release files for llmf 0.3.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 llmf 0.3.0
File Size Uploaded Provenance
llmf-0.3.0.tar.gz 51.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 100.2 kB

Release files / llmf-0.3.0.tar.gz

Download URL llmf-0.3.0.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c72f3b17d529ddf40b460e1232b7b81bbd5fcc395a7411c31bc0cc2c7ee789cc
BLAKE2b-256 checksum
How to use checksums
30ae94d52e680b3f59663aa992c4b7fc4c4822b529e4801115731ffc4778df87
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.3.0-py3-none-any.whl

Download URL llmf-0.3.0-py3-none-any.whl
Size 48.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30bd9ed73ac048db2a5cefbfd3d8a47600309e091e61a81cf353bac7ead1b7d7
BLAKE2b-256 checksum
How to use checksums
0a1387a31447c972e254f6a329527fff8a727fb38414d0cd0d0dea252fd896f9
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.3.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.

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