skillfed

g4f

The official gpt4free repository | various collection of powerful language models

g4f v8.1.6 138.2K downloads/30d#11,336 on PyPI66,551
License unclear Active released

What it is and what it does

GPT4Free (g4f) is a community-driven aggregator that wraps multiple LLM and media-generation providers into a single Python client library, REST API, and web GUI. It abstracts away provider-specific authentication and API differences, presenting a unified OpenAI-compatible interface for text generation, image creation, and local inference. The package ships with five runtime dependencies (requests, aiohttp, brotli, pycryptodome, nest-asyncio2) and supports both synchronous and asynchronous usage patterns.

The project provides multiple deployment options: a pure Python pip install, Docker containers (full and slim variants for x86_64 and arm64), a Windows .exe launcher, and an MCP (Model Context Protocol) server for integration with AI assistants. It includes a web GUI, FastAPI-based Interference API, CLI tools, and a JavaScript browser client. While actively maintained and popular (66551 GitHub stars, 138223 monthly downloads), it carries Pre-Alpha status and an unclear license, so production use should be preceded by legal review and provider compliance verification.

Use it for:

  • Build a chatbot or text-generation application that can switch between multiple LLM providers without code changes.
  • Generate images programmatically by routing requests to multiple image-generation services through a single interface.
  • Run a local web GUI or REST API server that aggregates free or accessible LLM access for team use.
  • Integrate web search, scraping, and image generation into Claude or other AI assistants via the MCP server.
  • Prototype or test AI features without committing to a single commercial provider's API and pricing.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Aggregates multiple LLM and media-generation providers into a unified Python client and REST API, offering multi-provider access to language models, image generation, and local inference backends.

Yes, with conditions. Install if you need multi-provider LLM or media-generation access and can accept Pre-Alpha stability and an unclear license. The low install friction, active maintenance, and large community are strong signals. However, verify the license terms before production use, understand that underlying providers may change or restrict access, and test provider stability for your use case. Not suitable for mission-critical applications without additional due diligence.

Install

g4f on PyPI

pip

pip install g4f

uv

uv add g4f

poetry

poetry add g4f

Installing g4f

Before you install

Low install friction with a pure-Python wheel and five runtime dependencies. Actively maintained with a release one day old and 66551 GitHub stars, though classified as Pre-Alpha development status.

License in practice

License treatment is unclear—no SPDX identifier or raw license text is recorded. Verify the actual license terms at the project repository before use, particularly if integrating into proprietary or commercial work.

Quickstart

pip install -U g4f[all]

from g4f.client import Client

client = Client()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)

Python 3.10+ required. Some providers require Chrome/Chromium for browser automation; check provider-specific documentation.

Verify before relying

  • Stability and uptime guarantees for aggregated third-party providers are not documented in the fact sheet.
  • Terms of service compliance for accessing underlying providers through g4f is not specified.
  • Performance characteristics (latency, rate limits) across different providers are not quantified.
  • Data retention and privacy handling for requests routed through the aggregator are not detailed.

Package facts

License not declared (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 5 — requests, aiohttp, brotli, pycryptodome, nest-asyncio2
Maintenance actively maintained — 1 days since the last release
Last repo commit
First released
Downloads 138,223/month — #11,336 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: g4f-8.1.6-py3-none-any.whl

Keywords: gpt4free, gpt4free.js, g4f, g4f.dev, javascript, npm, browser, gpt, chatgpt, deepseek, openai, ai, client, sdk, free, ai, gpt-4, gpt-4o, chat, api, browser, ai, ai, js, client, text, generation, image, generation, in-browser, ai, frontend, ai, openai, alternative, javascript, ai, library, nodejs, prompt, engineering, chatbot, ai, integration

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: Python :: 3

Tags

multi-provider llm clientopenai-compatible api wrapperfree language model accessimage generation aggregatorgpt4free python sdk
llm-aggregatoropenai-compatiblemulti-provider

More Artificial Intelligence packages