GP

GPT4Free

Unified OpenAI-compatible API gateway for many models

Self-Hosted AI ★ 66.7k 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

GPT4Free replaces

Compare GPT4Free

10 head-to-head comparisons.

Similar self-hosted ai apps