Skip to main content
LLM4Free Logo

LLM4Free

A collection of reverse-engineered website AIs — 40+ free LLM chat, image, speech, and search backends exposed through one OpenAI-compatible interface.

PyPI Version Monthly Downloads Total Downloads GitHub Stars GitHub Forks Python Version License Ask DeepWiki

Telegram Group YouTube Buy Me A Coffee


Overview

LLM4Free is a Python package that collects reverse-engineered backends for third-party AI websites and exposes them through a single, consistent interface modeled on the OpenAI SDK. Instead of integrating each site's private front-end yourself, you import one package and call client.chat.completions.create(...), client.images.generate(...), or client.audio.speech.create(...).

Every backend is adapted to the same response shapes, so you can switch providers by changing one argument. The unified Client adds automatic provider selection, model resolution, instance caching, and failover.

  • Chat: 31 LLM providers, most usable without an API key
  • Images: 13 text-to-image providers
  • Speech: 14 text-to-speech and 2 speech-to-text providers
  • Search: DuckDuckGo, Bing, Brave, Yahoo, Mojeek, Parallel, SerpBase, Wikipedia
  • Serving: a FastAPI server exposing OpenAI- and Anthropic-compatible endpoints
  • Utilities: HTML parsing, crawling, GitHub data, temporary mail, user-agent rotation, and more

Scope and disclaimer

See LEGAL_NOTICE.md for the full terms.

Key features

Capability What you get
OpenAI-compatible chat chat.completions.create(...) with streaming and tool calling
OpenAI-compatible images images.generate(...) / images.create(...)
OpenAI-compatible speech audio.speech.create(...) and audio.transcriptions.create(...)
Unified client Automatic provider selection, model resolution, caching, failover
Free-first defaults Auth-required providers are excluded unless explicitly enabled
Model registry Enumerate providers, models, and voices programmatically
API server OpenAI /v1 routes plus Anthropic /v1/messages compatibility
CLI Rich-powered search, weather, translation, maps, and more
Built-in HTTP client Zero-dependency, httpx-style client (llm4free.browser_requests._http) with optional browser TLS impersonation
Typed public API Type hints and consistent response objects throughout

How it works

  1. A third-party AI website exposes a public front-end used by its own web UI.
  2. Each provider in this package reproduces the requests that front-end makes and normalizes the response.
  3. The provider is adapted to the OpenAI-compatible shape: chat.completions.create(...), images.create(...), tts(...), or audio.transcriptions.create(...).
  4. The unified Client selects a working provider, resolves the requested model, caches instances, and fails over on error.

The result: services that were only usable in a browser become ordinary Python objects and standard HTTP endpoints.

Requirements

  • Python 3.10+
  • No API keys required for free providers
  • No HTTP libraries required for the built-in client — it runs on the standard library
  • Optional: fastapi and uvicorn for the API server ([api] extra)
  • Optional: primp for browser TLS/JA3 + HTTP/2 fingerprinting ([impersonate] extra)

Installation

# Core package
pip install -U llm4free

# With the OpenAI-compatible API server
pip install -U "llm4free[api]"

# With browser TLS/JA3 + HTTP/2 fingerprinting for the built-in HTTP client
pip install -U "llm4free[impersonate]"

# With development tools
pip install -U "llm4free[dev]"

With uv (recommended):

uv add llm4free
uv add "llm4free[impersonate]"   # optional browser-fingerprinting backend
uv run llm4free --help
uv tool install llm4free

Docker:

docker build -t llm4free-api .
docker run -p 8000:8000 llm4free-api

Quick start

from llm4free import Client

client = Client(print_provider_info=True)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Explain quantum computing in simple terms."}],
)

print(response.choices[0].message.content)
print(client.chat.completions.last_provider)

model="auto" lets the client choose a working provider and model. To pin a backend, use "Provider/Model":

client.chat.completions.create(
    model="Gemini/gemini-3.6-flash",
    messages=[{"role": "user", "content": "Hello!"}],
)

Fuzzy model names are also resolved across providers, so model="gpt-4o" will match a provider that serves an equivalent model.

Chat completions

Basic usage

from llm4free import Client

client = Client()
response = client.chat.completions.create(
    model="auto",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Summarize the plot of Hamlet in three sentences."},
    ],
)
print(response.choices[0].message.content)

Streaming

stream = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Write a short poem about the sea."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Tool calling

weather_tool = {
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get the current weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "What is the weather in London?"}],
    tools=[weather_tool],
)
print(response.choices[0].message.tool_calls)

Direct provider usage

Every provider implements the same interface and can be instantiated directly:

from llm4free.llm.gemini import Gemini

client = Gemini()
response = client.chat.completions.create(
    model="gemini-3.6-flash",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Authenticated providers accept an api_key:

from llm4free.llm.Auth.groq import Groq

client = Groq(api_key="your-key")
response = client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "Write a Python function to sort a list."}],
)

Image generation

from llm4free import Client

client = Client(print_provider_info=True)

image = client.images.generate(
    prompt="A serene mountain landscape at sunset",
    model="auto",
    size="1024x1024",
)
print(image.data[0].url)

images.create(...) is an alias. To force a backend:

image = client.images.generate(
    prompt="A cyberpunk city at night",
    model="PollinationsAI/flux",
)

Direct provider usage:

from llm4free.TTI import PollinationsAI

generator = PollinationsAI()
image = generator.images.create(model="flux", prompt="A cyberpunk city at night")
print(image.data[0].url)

Text-to-speech

from llm4free import Client

client = Client(print_provider_info=True)

audio = client.audio.speech.create(
    input_text="Welcome to the weekly product update.",
    model="auto",
    response_format="mp3",
)
print(audio)  # path to the generated audio file

With stream=True, the call returns a byte-chunk generator:

chunks = client.audio.speech.create(
    input_text="Streaming speech synthesis.",
    model="auto",
    stream=True,
)
with open("speech.mp3", "wb") as handle:
    for chunk in chunks:
        handle.write(chunk)

Direct provider usage:

from llm4free.TTS import ParlerTTS

tts = ParlerTTS()
audio_path = tts.tts("Hello, world!")
print(audio_path)

Speech-to-text

STT providers follow the OpenAI Whisper API shape:

from llm4free.STT import ElevenLabsSTT

stt = ElevenLabsSTT()
with open("audio.mp3", "rb") as audio_file:
    transcription = stt.audio.transcriptions.create(
        model="scribe_v1",
        file=audio_file,
        response_format="text",
    )
print(transcription.text)

Available providers: ElevenLabsSTT, CohereSTT.

client.search gives every engine an OpenAI-style entry point:

from llm4free import Client

client = Client()
response = client.search.create(
    query="best practices for API design",
    engine="auto",       # or "duckduckgo", "bing", "brave", ...
    max_results=5,
)

print(response.engine)   # e.g. "duckduckgo"
for result in response.data:
    print(result.title, result.href)

Pin an engine, query another category, or serialize the response:

client.search.create(query="climate change", engine="bing", max_results=5)
client.search.images("mount everest", max_results=5)
client.search.news("ai regulation", engine="yahoo")
client.search.weather("Tokyo", engine="yahoo")
client.search.text("fastapi").to_dict()

Engines: duckduckgo, bing, brave, yahoo, mojeek, wikipedia, parallel, and serpbase (requires SERPBASE_API_KEY). Auto mode fails over across engines; inspect support with client.search.list_engines() and client.search.capabilities().

The engine classes are still available for direct use:

from llm4free import DuckDuckGoSearch

search = DuckDuckGoSearch()
results = search.text("best practices for API design", max_results=5)

for result in results:
    print(result["title"], result["href"])

Provider catalog

All chat providers implement chat.completions.create(...). Auth-required providers are excluded by the unified client by default; pass drop_auth_providers=False and an api_key to enable them.

Chat — free (no key required)

Provider Class Notes
Gemini Gemini Multiple Gemini models
GptFree GptFree GPT-4o-compatible endpoint
ChatGPT ChatGPT Public ChatGPT front-end
Toolbaz Toolbaz Multiple models
IBM IBM IBM Granite Playground
PiAI PiAI Inflection Pi front-end
AkashGPT AkashGPT —
ChatJimmy ChatJimmy —
ChatBotChatApp ChatBotChatApp Multiple hosted models, SSE streaming
AskMeAI AskMeAI Agentic chat front-end, SSE streaming
K2Think K2Think —
Miklium Miklium —
Netwrck Netwrck —
OllamaSwarm OllamaSwarm Ollama-style swarm endpoint
TypliAI TypliAI —
WiseCat WiseCat —

Chat — authenticated

Provider Class Module
AI4Chat AI4Chat llm.ai4chat
Cerebras Cerebras llm.Auth.cerebras
DeepAI DeepAI llm.Auth.deep_ai
DeepInfra DeepInfra llm.Auth.deepinfra
Groq Groq llm.Auth.groq
HuggingFace HuggingFace llm.Auth.huggingface
Nvidia Nvidia llm.Auth.nvidia
OpenRouter OpenRouter llm.Auth.openrouter
Sambanova Sambanova llm.Auth.sambanova
TextPollinations TextPollinations llm.Auth.textpollinations
TogetherAI TogetherAI llm.Auth.together_ai
TwoAI TwoAI llm.Auth.two_ai
UncensoredChat UncensoredChat llm.Auth.uncensoredchat
Upstage Upstage llm.Auth.upstage
Zenmux Zenmux llm.Auth.zenmux

Text-to-image

BingImageAI, Lexica, MagicHourAI, MagicStudioAI, MiragicAI, NoLoginTool, OneFreeAI, PerchanceAI, PollinationsAI, RaphaelAI, StableHordeAI, TogetherImage, VisualGPT

Text-to-speech

DeepgramTTS, ElevenlabsTTS (key required), KittenTTS, LuxTTS, MurfAITTS, OpenAIFMTTS, ParlerTTS, KyutaiTTS, QwenTTS, SherpaTTS, StreamElements, TTSAI, TTSOpenTTS, XLNKTTS

Speech-to-text

ElevenLabsSTT, CohereSTT

Search engines

Module Classes
llm4free.search DuckDuckGoSearch, BingSearch, BraveSearch, YahooSearch, Search, SearchResponse
llm4free.search.engines Mojeek, Parallel, SerpBase, Wikipedia

Model registry

from llm4free import model

# Provider -> models mapping
llm_models = model.llm.list()
print(f"Providers: {len(llm_models)}")

summary = model.llm.summary()
print(f"Total models: {summary['models']}")

for provider, count in summary["provider_model_counts"].items():
    print(f"  {provider}: {count} models")

# Provider -> voices mapping
tts_voices = model.tts.list()

# Provider -> models mapping
tti_models = model.tti.list()

Detailed metadata is available through model.llm.providers() and model.llm.provider("Gemini").

OpenAI-compatible server

Start a local FastAPI server that exposes every wrapped backend through standard routes:

llm4free-server
llm4free-server --port 8080 --host 0.0.0.0 --debug

Or from Python:

from llm4free.client import run_api

run_api(host="0.0.0.0", port=8000)

Endpoints

Method Path Purpose
GET /health Health check
GET /v1/models List models
GET /v1/models/{model} Retrieve a model
GET /v1/providers List chat providers
POST /v1/chat/completions Chat completions (streaming supported)
POST /v1/messages Anthropic-compatible messages
POST /v1/images/generations Image generation
POST /v1/audio/speech Text-to-speech
GET /v1/TTI/models List image models
GET /v1/TTS/models List speech models
GET /search Unified web search

OpenAI client

from openai import OpenAI

client = OpenAI(api_key="dummy", base_url="http://localhost:8000/v1")

response = client.chat.completions.create(
    model="Gemini/gemini-3.6-flash",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Docker Compose

docker compose up llm4free-api
docker compose -f docker-compose.yml -f docker-compose.no-auth.yml up llm4free-api

Full reference: docs/openai-api-server.md | Deployment: docs/DOCKER.md

Command-line interface

llm4free --help
llm4free version

llm4free text -k "python programming"
llm4free images -k "mountains"
llm4free videos -k "documentary"
llm4free news -k "AI breakthrough"
llm4free weather -l "New York"
llm4free answers -k "what is quantum entanglement"
llm4free suggestions -q "python"
llm4free translate -k "Hola" --to en
llm4free maps -k "coffee shops" -p "London"
llm4free search -k "climate change" -e bing

Engines

Command Engines
text ddg, bing, yahoo, brave, mojeek, parallel, wikipedia, serpbase
images ddg, bing, yahoo, brave
videos ddg, brave, yahoo
news ddg, bing, yahoo, brave
suggestions ddg, bing, yahoo, brave
answers ddg
maps ddg
translate ddg
weather ddg
llm4free text -k "climate change" -e bing
llm4free text -k "quantum physics" -e wikipedia

Full CLI reference: docs/cli.md

Developer tools

Tool Description Docs
Scout HTML parser and web crawler docs/scout.md
LitPrinter Styled debug printing docs/litprinter.md
LitAgent User-agent rotation docs/litagent.md
GitAPI GitHub data extraction docs/gitapi.md
Decorators @timeIt and @retry docs/decorators.md
Sanitize Stream sanitization docs/sanitize.md
Prompts System prompt manager docs/awesome-prompts.md

Configuration

Client options

Option Type Description
provider type Default chat provider class
image_provider type Default image provider class
api_key str Key for authenticated providers
proxies dict Proxy configuration applied to all requests
exclude list[str] Provider names to exclude from chat
exclude_images list[str] Provider names to exclude from images
exclude_tts list[str] Provider names to exclude from speech
exclude_search list[str] Engine ids to exclude from search auto-selection
print_provider_info bool Print the selected provider and model
drop_auth_providers bool Exclude auth-required providers (default True)

Environment variables

Variable Default Description
LLM4FREE_HOST 0.0.0.0 Server bind address
LLM4FREE_PORT 8000 Server port
LLM4FREE_WORKERS 1 Server worker processes
LLM4FREE_LOG_LEVEL info Server log level
LLM4FREE_DEFAULT_PROVIDER — Default provider for the server
LLM4FREE_BASE_URL — Base URL prefix for routes
LLM4FREE_DEBUG false Enable debug mode
LLM4FREE_NO_UPDATE — Set to 1 to disable the update check

Project structure

llm4free/
├── client.py          # Unified Client with failover and model resolution
├── cli.py             # Rich-powered command-line interface
├── models.py          # Model, voice, and provider registry
├── llm/               # Chat providers (free and authenticated)
├── TTI/               # Text-to-image providers
├── TTS/               # Text-to-speech providers
├── STT/               # Speech-to-text providers
├── search/            # Search engines and result models
├── AISEARCH/          # AI-powered search backends
├── browser_requests/  # Browser automation + the built-in HTTP client (_http)
├── server/            # FastAPI OpenAI/Anthropic-compatible server
├── Extra/             # GitAPI, temp-mail, YouTube toolkit, utilities
├── scout/             # HTML parser and crawler
└── litagent/          # User-agent rotation

Documentation

Resource Description
Getting Started Installation and first chat
Architecture System design and data flows
Client Unified client and failover behavior
CLI Reference Commands and options
API Server OpenAI-compatible server
Model Registry Enumerating models and voices
Tool Calling Function calling across providers
Search Multi-engine search API
HTTP Client Built-in zero-dependency HTTP client and impersonation
Provider Development Writing custom providers
Deployment Production deployment
Docker Images and Compose profiles
Troubleshooting Common issues
Docs Hub Full documentation index

Contributing

Contributions are welcome: new providers, search engines, bug fixes, tests, and documentation.

  1. Fork the repository.
  2. Create a feature branch.
  3. Make focused changes with descriptive commits.
  4. Open a pull request.

See docs/contributing.md and docs/provider-development.md.

Please verify that any new backend complies with the target service's terms of use before submitting.

Released under Apache-2.0. See LICENSE.md.


Made with ❤️ by the LLM4Free team · GitHub · PyPI · Telegram

Metadata

Release files for llm4free 2026.10.30

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

Source distribution (sdist)

Source distribution for llm4free 2026.10.30
File Size Uploaded Provenance Actions
llm4free-2026.10.30.tar.gz 535.5 kB Without provenance Details for llm4free-2026.10.30.tar.gz

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / llm4free-2026.10.30.tar.gz

Download URL llm4free-2026.10.30.tar.gz
Size 535.5 kB
Tags Source
SHA-256 checksum
How to use checksums
557a3ff32556cd34cb253203fc41f2e9a9d4b8a638a2b63de99b8dc66db1f5dc
BLAKE2b-256 checksum
How to use checksums
e73703c2b15cf80dde2dcab27597648ff6d93329a27f2410e37e7fe12bde5851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / llm4free-2026.10.30-py3-none-any.whl

Download URL llm4free-2026.10.30-py3-none-any.whl
Size 668.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ed4a6eaa5300fe1ff7ab8be06fd15a876fb5cf30ed211c303886008f6af15a0
BLAKE2b-256 checksum
How to use checksums
b1bcda157d22a89ba8dbc187f9d57e17d266ee6dca493047442bf7057ff2b825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for llm4free 2026.10.30

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