A high-performance, OpenAI-compatible API server written in Go that gives you free access to ChatGPT β including GPT-5.5, GPT-4o, GPT Image Generation, and more. No API key required. Fully automated session authentication via a lightweight Chrome extension.
| Problem | Solution |
|---|---|
| OpenAI API costs $20+/month | This is 100% free |
| API keys get leaked and abused | No API keys needed |
| Rate limits on free tiers | Uses your own ChatGPT session |
| Complex auth setup | One-click Chrome extension auto-syncs cookies |
| Want OpenAI-compatible endpoints | Drop-in replacement for /v1/chat/completions |
- π¬ OpenAI Chat Completions β Standard
/v1/chat/completionsendpoint, works with any OpenAI client library - π¨ Image Generation β Generate images via ChatGPT's built-in DALL-E, auto-downloaded to
output/ - π Conversation Persistence β Same conversation continues across requests (no rate limit issues from new chats)
- π Chrome Cookie Bridge β Lightweight extension auto-syncs your ChatGPT session cookies via WebSocket
- β‘ Zero Config β Just set port and model in
.env, everything else is hardcoded for reliability - π§ Multi-Model Support β GPT-5.5, GPT-4o, GPT-4o-mini, o3, o4-mini and more
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Your App ββββββΆβ Go API Server ββββββΆβ ChatGPT Web β
β (curl/SDK) βββββββ (localhost:9225) βββββββ (chatgpt.com) β
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β²
β WebSocket (cookies)
ββββββββ΄ββββββββ
β Chrome β
β Extension β
ββββββββββββββββ
- Chrome Extension captures your ChatGPT session cookies and sends them to the Go server via WebSocket
- Go Server receives your API request at
/v1/chat/completions - Server forwards the request to ChatGPT's web backend using your session cookies
- Response is formatted as a standard OpenAI API response and returned to your app
You can run the API server inside a Docker container:
# Build the Docker image
docker build -t chatgpt-free-api:latest .
# Run the container (binds to host port 9225)
docker run -d \
--name chatgpt-free-api \
-p 9225:9225 \
--restart unless-stopped \
chatgpt-free-api:latestTo build/run locally without Docker:
go run .- Open
chrome://extensions/in Chrome. - Enable Developer mode (top right toggle).
- Click Load unpacked (top left button) β select the
gpt-extension/folder in this repository. - Open chatgpt.com and log in.
- Click on the extension icon. By default, it connects to port
9225.[!TIP] If you configured the server to run on a different port, you can change the Server Port inside the extension popup UI directly. It will dynamically save and reconnect to the new port without reloading the extension.
# Chat (OpenAI-compatible)
curl -X POST http://localhost:9225/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Hello!"}]
}'Request:
{
"model": "gpt-5-5",
"messages": [
{"role": "user", "content": "Your prompt here"}
],
"conversation_id": "optional-to-continue-chat"
}Response:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5-5",
"conversation_id": "6a404fee-921c-83ee-850e-f2a582c56e7c",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Hello!"},
"finish_reason": "stop"
}
]
}{
"prompt": "Your message",
"conversation_id": "",
"model": "gpt-5-5"
}| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions |
POST | OpenAI-compatible chat |
/api/chat |
GET/POST | Native chat endpoint |
/api/chat/bulk |
POST | Batch multiple prompts |
/api/chat/edit |
POST | Edit last message |
/api/sniffs |
GET | View request logs |
/health |
GET | Server health check |
Only 2 values in .env β everything else is hardcoded for stability:
LISTEN_ADDR=127.0.0.1:9225
DEFAULT_MODEL=gpt-5-5| Variable | Default | Description |
|---|---|---|
LISTEN_ADDR |
127.0.0.1:9225 |
Server address and port |
DEFAULT_MODEL |
gpt-5-5 |
Default ChatGPT model |
chatgpt-free-api/
βββ main.go # Entry point
βββ .env # Server config (port + model)
βββ chatgpt/ # Core Go source code
β βββ agent.go # Server bootstrap & routing
β βββ handlers.go # HTTP request handlers
β βββ chatgpt.go # ChatGPT web client & WebSocket bridge
β βββ config.go # .env config loader
β βββ cookies.go # Cookie management
β βββ api_bridge.go # Image download bridge
β βββ extension.go # Chrome extension WebSocket handler
β βββ helpers.go # Utility functions
β βββ sniff.go # Request logging/sniffing
βββ gpt-extension/ # Chrome extension
β βββ manifest.json
β βββ background.js
β βββ popup.html
β βββ popup.js
βββ output/ # Auto-downloaded generated images
This tool uses your own ChatGPT session β it does not share credentials with any third party. All communication happens between your local machine and ChatGPT's servers. The Chrome extension only sends cookies to localhost.
MIT License β free to use, modify, and distribute.
