GPT4Free
Unified OpenAI-compatible API gateway for many models
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-stoppeddocker run
docker run -d --name gpt4free \
-p 8080:8080 \
-p 1337:8080 \
-p 7900:7900 \
-v ./app:/app \
--restart unless-stopped \
hlohaus789/g4f:latestPros & 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
OpenClaw
Self-Hosted AIThe AI that actually does things
Hermes Agent
Self-Hosted AIThe AI agent that grows with you
OpenCode
Self-Hosted AIThe open source AI coding agent
Replaces Claude Code, Cursor
Hugging Face Transformers
Self-Hosted AIState-of-the-art machine learning model library
Replaces OpenAI API
Dify
Self-Hosted AIOpen-source platform for building production LLM apps
Replaces OpenAI Assistants, Vertex AI Agent Builder
Langflow
Self-Hosted AIVisual framework for building AI agents and RAG pipelines
Replaces Vertex AI Agent Builder