{"id":49407756,"url":"https://github.com/mrshibly/phantomapi","last_synced_at":"2026-04-28T22:05:27.638Z","repository":{"id":347628720,"uuid":"1194668013","full_name":"mrshibly/PhantomAPI","owner":"mrshibly","description":"👻 PhantomAPI — Turn ChatGPT's free web interface into an OpenAI-compatible API. Built with FastAPI + Playwright. Drop-in replacement for n8n, AI Agents, and any OpenAI client. Zero API costs.","archived":false,"fork":false,"pushed_at":"2026-03-28T18:00:38.000Z","size":2394,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T19:28:47.538Z","etag":null,"topics":["ai-agent","automation","chatgpt","chatgpt-proxy","fastapi","free-api","n8n","openai-api","openai-compatible","phantomapi","playwright","proxy","python","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrshibly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-28T16:56:48.000Z","updated_at":"2026-03-28T18:00:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mrshibly/PhantomAPI","commit_stats":null,"previous_names":["mrshibly/phantomapi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mrshibly/PhantomAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrshibly%2FPhantomAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrshibly%2FPhantomAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrshibly%2FPhantomAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrshibly%2FPhantomAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrshibly","download_url":"https://codeload.github.com/mrshibly/PhantomAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrshibly%2FPhantomAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32400960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","automation","chatgpt","chatgpt-proxy","fastapi","free-api","n8n","openai-api","openai-compatible","phantomapi","playwright","proxy","python","self-hosted"],"created_at":"2026-04-28T22:05:24.717Z","updated_at":"2026-04-28T22:05:27.633Z","avatar_url":"https://github.com/mrshibly.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 👻 PhantomAPI\n\n### Turn ChatGPT into a FREE OpenAI-Compatible API\n\n[![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge\u0026logo=fastapi)](https://fastapi.tiangolo.com/)\n[![Playwright](https://img.shields.io/badge/Playwright-2EAD33?style=for-the-badge\u0026logo=playwright\u0026logoColor=white)](https://playwright.dev/)\n[![Docker](https://img.shields.io/badge/Docker-2CA5E0?style=for-the-badge\u0026logo=docker\u0026logoColor=white)](https://docker.com/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)\n\n**The invisible proxy that bridges ChatGPT's free web interface with your AI automation workflows.**\n\n[Quick Start](#-quick-start) · [n8n Integration](#-connecting-to-n8n) · [Architecture](#-architecture) · [Docker](#-docker-deployment)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cvideo src=\"demo.mp4\" width=\"800\" controls muted autoplay loop\u003e\u003c/video\u003e\n\u003c/div\u003e\n\n---\n\n## 🌟 What is PhantomAPI?\n\n**PhantomAPI** is a high-performance proxy server that makes ChatGPT's free web interface behave like the official OpenAI API. It's designed as a **drop-in replacement** for any tool that speaks the OpenAI protocol — especially **n8n**.\n\n### ✨ Key Features\n\n| Feature | Description |\n|:---|:---|\n| 💸 **Zero API Costs** | Uses ChatGPT's free web interface via headless browser automation |\n| ⚡ **Async Architecture** | Built on FastAPI with a dedicated browser thread for non-blocking requests |\n| 🤖 **AI Agent Support** | Full tool-calling / function-calling support for n8n Agent nodes |\n| 🔒 **API Key Auth** | Protected with Bearer token authentication |\n| 🐳 **Docker Ready** | Deploy in seconds with `docker-compose up` |\n| 🎨 **Built-in GUI** | A sleek dark-mode chat interface for quick testing |\n| 📐 **Clean Architecture** | Proper FastAPI structure — routers, schemas, services, utils |\n\n---\n\n## ⚙️ How It Works\n\n```\n┌──────────┐     HTTP/JSON      ┌──────────────┐     Playwright     ┌──────────────┐\n│   n8n    │ ──────────────────▶ │  PhantomAPI  │ ──────────────────▶ │  ChatGPT     │\n│  (or any │ ◀────────────────── │  (FastAPI)   │ ◀────────────────── │  (Web UI)    │\n│  client) │   OpenAI Schema     │              │   Scrape Response   │              │\n└──────────┘                     └──────────────┘                     └──────────────┘\n```\n\n1. **You send** a standard OpenAI API request to PhantomAPI\n2. **PhantomAPI** formats your messages into a prompt and types it into ChatGPT's web interface using a stealth browser\n3. **ChatGPT responds** on the web page — PhantomAPI scrapes the text\n4. **The response** is formatted back into the official OpenAI JSON schema and returned to you\n\n---\n\n## 🛠️ Quick Start\n\n### Prerequisites\n- **Python 3.10+**\n- **Google Chrome** installed on your system\n\n### 1. Clone \u0026 Install\n\n```bash\ngit clone https://github.com/mrshibly/phantom-api.git\ncd phantom-api\npip install -r requirements.txt\npython -m playwright install chromium\n```\n\n### 2. Configure\n\n```bash\ncp .env.example .env\n# Edit .env and set your API_SECRET_KEY\n```\n\n### 3. Run\n\n```bash\npython run.py\n```\n\nThe server will start on `http://localhost:7777`.\n\n| Endpoint | Description |\n|:---|:---|\n| `http://localhost:7777/` | Health check |\n| `http://localhost:7777/docs` | Swagger UI (interactive API docs) |\n| `http://localhost:7777/gui` | Chat GUI for quick testing |\n\n---\n\n## 🔌 Connecting to n8n\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"n8n_preview.png\" width=\"800\" alt=\"n8n Workflow Example\"\u003e\n\u003c/div\u003e\n\n### Method 1: OpenAI Node (Recommended)\n\n1. In n8n, go to **Credentials → New → OpenAI API**\n2. Set **Base URL** to: `http://127.0.0.1:7777/v1`\n3. Set **API Key** to your `API_SECRET_KEY` from `.env`\n4. Use this credential in any **OpenAI** or **AI Agent** node\n\n\u003e **Docker Tip:** If n8n runs in Docker, use `http://host.docker.internal:7777/v1`\n\n### Method 2: HTTP Request Node\n\n1. Add an **HTTP Request** node\n2. **Method:** `POST`\n3. **URL:** `http://127.0.0.1:7777/v1/chat/completions`\n4. **Authentication:** Header Auth → `Authorization: Bearer YOUR_KEY`\n5. **Body (JSON):**\n\n```json\n{\n  \"model\": \"gpt-4o-mini\",\n  \"messages\": [\n    { \"role\": \"user\", \"content\": \"Hello, PhantomAPI!\" }\n  ]\n}\n```\n\n---\n\n## 📐 Architecture\n\n```\nphantom-api/\n├── app/\n│   ├── main.py              # App factory, CORS, lifespan\n│   ├── config.py            # Environment-driven settings\n│   ├── dependencies.py      # Auth dependency injection\n│   ├── api/v1/\n│   │   ├── router.py        # Route aggregator\n│   │   ├── chat.py          # POST /v1/chat/completions\n│   │   ├── responses.py     # POST /v1/responses\n│   │   └── models.py        # GET  /v1/models\n│   ├── schemas/\n│   │   ├── chat.py          # Request/Response models\n│   │   └── responses.py     # Responses API models\n│   ├── services/\n│   │   └── browser.py       # Playwright browser engine\n│   └── utils/\n│       ├── prompt.py         # Smart prompt builder\n│       └── parser.py         # Tool-call JSON parser\n├── static/\n│   └── index.html            # Chat GUI\n├── tests/\n│   └── test_health.py        # Endpoint tests\n├── Dockerfile\n├── docker-compose.yml\n├── requirements.txt\n├── .env.example\n└── run.py                    # Entry point\n```\n\n---\n\n## 🐳 Docker Deployment\n\n```bash\n# Build and run\ndocker-compose up --build -d\n\n# The server is now running on http://localhost:7777\n```\n\n---\n\n## 🔧 API Reference\n\n### `POST /v1/chat/completions`\n\nStandard OpenAI Chat Completions endpoint. Supports messages, tools, and function calling.\n\n### `POST /v1/responses`\n\nModern Responses API for newer n8n versions. Accepts `input` (string or messages) and optional `instructions`.\n\n### `GET /v1/models`\n\nReturns available model identifiers (used by n8n's model dropdown).\n\n### `GET /`\n\nHealth check — returns server status and version.\n\n---\n\n## 📄 License\n\nThis project is open-sourced under the [MIT License](LICENSE).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ by [mrshibly](https://github.com/mrshibly)**\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrshibly%2Fphantomapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrshibly%2Fphantomapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrshibly%2Fphantomapi/lists"}