GP

GPT4Free

Unified OpenAI-compatible API gateway for many models

Self-Hosted AI ★ 66.8k stars Medium setup GPL-3.0

GPT4Free is an open-source project that provides a unified, OpenAI-compatible API and interface for accessing a variety of language and image models. It can be self-hosted as a gateway to route requests across multiple model providers.

Key features

  • OpenAI-compatible API
  • Multiple provider routing
  • Self-hosted gateway
  • Image and text models

Quick deploy

A starting point for self-hosting GPT4Free - check the official docs for the full set of options.

  • Image hlohaus789/g4f:latest
  • Web port 8080
  • Persist /app
Docker Compose
services:
  gpt4free:
    image: hlohaus789/g4f:latest
    ports:
      - "8080:8080"
      - "1337:8080"
      - "7900:7900"
    volumes:
      - ./app:/app
    restart: unless-stopped
docker run
docker run -d --name gpt4free \
  -p 8080:8080 \
  -p 1337:8080 \
  -p 7900:7900 \
  -v ./app:/app \
  --restart unless-stopped \
  hlohaus789/g4f:latest

Pros & cons

Strengths

  • OpenAI-compatible API
  • Many providers supported
  • No usage costs

Trade-offs

  • Provider reliability varies
  • Subject to upstream changes

Is GPT4Free secure?

OSV.dev has no published security advisories for GPT4Free's repository. No known vulnerabilities is not proof of security: it means none have been publicly catalogued.

  • Image signature No signature found in the registry for hlohaus789/g4f:latest (signatures stored elsewhere can't be detected)

Source: OSV.dev, checked 2026-10-14. How this is measured.

GPT4Free replaces

Health badge

Maintain GPT4Free? Add its health score to your README. The badge links back to this page.

SelfHostIndex: 100 · excellent

Markdown
[![SelfHostIndex health score for GPT4Free](https://selfhostindex.com/badge/gpt4free.svg)](https://selfhostindex.com/app/gpt4free/)
HTML
<a href="https://selfhostindex.com/app/gpt4free/"><img src="https://selfhostindex.com/badge/gpt4free.svg" alt="SelfHostIndex health score for GPT4Free"></a>
reStructuredText
.. image:: https://selfhostindex.com/badge/gpt4free.svg
   :alt: SelfHostIndex health score for GPT4Free
   :target: https://selfhostindex.com/app/gpt4free/

The score is recomputed on every nightly rebuild from public repository data — see how it is calculated.

Compare GPT4Free

10 head-to-head comparisons.

Similar self-hosted ai apps