gpt4free  by xtekky

API package for multi-provider LLM requests (GPT-4.1, Gemini 2.5, Deepseek R1)

created 2 years ago
64,780 stars

Top 0.3% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a Python package and Docker image for accessing various large language models (LLMs) and image generation models, acting as a proof-of-concept for a multi-provider API. It targets developers and researchers looking for flexible access to AI models beyond proprietary APIs, offering features like load balancing and timeouts.

How It Works

The project aggregates access to numerous LLM providers, abstracting away individual API complexities. It utilizes a client-server architecture, with a FastAPI backend providing an OpenAI-compatible API endpoint and a web UI. The core advantage lies in its dynamic provider selection and fallback mechanisms, enabling users to access a wide range of models through a unified interface.

Quick Start & Requirements

  • Python: pip install -U g4f[all]
  • Docker: docker pull hlohaus789/g4f and docker run ... (see README for full command)
  • Prerequisites: Python 3.10+, Google Chrome (for some providers).
  • Documentation: gpt4free.github.io/docs

Highlighted Details

  • Supports text generation (e.g., GPT-4.1, Gemini 2.5) and image generation.
  • Offers an OpenAI-compatible API endpoint (http://localhost:1337/v1).
  • Includes a web interface for direct interaction.
  • Supports running on smartphones via its web UI.

Maintenance & Community

Licensing & Compatibility

  • Licensed under GNU GPL v3.0. This is a strong copyleft license, requiring derivative works to also be open-sourced under the GPL.

Limitations & Caveats

The project is explicitly described as a "proof of concept" and relies on unofficial access methods to various AI providers, which may be unstable or subject to change without notice. Some providers may require specific browser installations or configurations.

Health Check
Last commit

1 day ago

Responsiveness

1 day

Pull Requests (30d)
8
Issues (30d)
43
Star History
1,168 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.