What is WebAI2API?
WebAI2API is a self-hosted server that drives web AI chat sites like LMArena and Gemini in Camoufox browser windows and exposes them as an OpenAI-compatible API. The README says it simulates human typing and mouse movement and uses feature camouflage to avoid automation detection. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in JavaScript and licensed MIT.
Overview
WebAI2API is an open-source Node.js server, released under the MIT license, that turns web-based AI chat services into a general API. Instead of calling a provider's official API, it opens the site in a Camoufox (Playwright) browser window that you have logged into yourself, types the prompt, waits for the answer and returns it through OpenAI-format endpoints: `POST /v1/chat/completions` with streaming, `GET /v1/models`, and `GET /v1/cookies` for reading the session cookies the browser keeps renewed. The README says it simulates human typing and mouse movement and uses feature camouflage to avoid automation detection.

The README's support table covers LMArena, Gemini Enterprise Business, Nano Banana Free, zAI, Google Gemini, ZenMux, ChatGPT, DeepSeek, Sora, Google Flow and Doubao, each marked for text, image or video generation; the example config also lists a Claude.ai text adapter. Each site is an adapter type. A browser instance is a separate Camoufox process with its own user-data directory (`userDataMark`) and optional per-instance proxy, so several accounts stay isolated; workers are tabs inside an instance, each bound to one adapter. A pool schedules requests across all workers (least busy, round robin or random), with a task queue, failover to another worker serving the same model, and retries. A `merge` worker lets one tab serve several backends.
A web admin UI on port 3000 shows system status and the task queue, edits server, worker-pool, browser and adapter settings, has an API test panel, a log viewer, and a virtual-display (VNC) view of the Xvfb browser windows on Linux and Docker, which is how you log in to each site the first time. The project carries an explicit disclaimer: it is for educational and exchange purposes only, the author is not responsible for consequences such as account suspension, and users should comply with the terms of service of the sites involved. The README also notes that requests are slow because they go through a real browser, that non-streaming requests are rejected once the backlog exceeds the configured limit, and recommends running headful (or under Xvfb) rather than headless, since headless mode may be detected.
What it does
- OpenAI-compatible `/v1/chat/completions` (streaming with `:keepalive` heartbeats so queued requests do not time out), `/v1/models` and `/v1/cookies` endpoints, protected by a bearer token

- Adapters for LMArena, Google Gemini, Gemini Enterprise Business, ChatGPT, DeepSeek, Doubao, zAI, ZenMux, Nano Banana Free, Sora and Google Flow, covering text, image and video generation where each site offers it
- Multi-account isolation: each browser instance gets its own Camoufox user-data directory and its own proxy (the example config shows SOCKS5 with optional auth)
- Worker pool with least-busy, round-robin or random scheduling, a task queue, automatic failover and retries, plus `merge` workers that serve several backends from one tab

- Image input as Base64 data URLs (PNG, JPEG, GIF, WebP, up to 10 per request, fewer on some sites), converted to JPG before upload
- Web admin UI with dashboard, configuration and instance management, API tester, log viewer and an in-browser VNC view of the virtual display
Getting started
Commands come from the project's README and deployment guide. WebAI2API needs Node.js 20 or later and runs on Windows, Linux and macOS; Camoufox is downloaded during setup. You need your own account on each site you want to use.
Install from source
Clone the repo, install dependencies, then run `npm run init` to fetch the Camoufox browser and other precompiled pieces. That script downloads from GitHub; pass `-proxy` if your network needs one. On Linux, also install the virtual-display packages.
git clone https://github.com/foxhui/WebAI2API.git
cd WebAI2API
pnpm install
npm run init
# Linux only
apt install -y xvfb x11vnc libgtk-3-0 libx11-xcb1 libasound2Or run it with Docker
The image enables Xvfb and VNC by default and keeps its config and browser data in the mounted `data` folder. A `docker-compose.yaml` is in the repo for `docker compose up -d`.
docker run -d --name webai-2api \
-p 3000:3000 \
-v "$(pwd)/data:/app/data" \
--shm-size=2gb \
foxhui/webai-2apiSet the API token
On first run `config.example.yaml` is copied to `data/config.yaml`. Change `auth` (it guards both the API and the web UI; `npm run genkey` generates one), configure instances and workers under `backend.pool`, and restart for changes to take effect.
server:
port: 3000
auth: sk-change-me-to-your-secure-keyStart the server and log in to each site
On Linux start it with a virtual display, open http://localhost:3000, connect in the Virtual Display section and log in to each AI site by hand, sending one message to clear any human verification. On Windows the browser window opens directly. The WebUI is unencrypted, so on a public server reach it through an SSH tunnel or HTTPS.
npm start -- -xvfb -vnc
# login mode: temporarily disables headless mode and automation
npm start -- -login -xvfb -vnc
# from your own machine, for a remote server
ssh -L 3000:127.0.0.1:3000 root@Server_IP
Call it like the OpenAI API
List the models your configured adapters offer, then send a chat request. The README strongly recommends `stream: true`, which keeps the connection alive while the request waits in the queue.
curl http://localhost:3000/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
curl http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gemini-3-pro",
"messages": [{"role": "user", "content": "Hello, please introduce yourself"}],
"stream": true
}'Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reach for it to point an OpenAI-compatible client or script at a chat site you already use through its web interface, such as LMArena or Gemini
- Reach for it to run image or video generation offered on sites like Gemini, ChatGPT or Sora from your own code through one endpoint
- Reach for it to spread requests over several of your own logged-in accounts, each in an isolated browser profile behind its own proxy
- Reach for it to export the session cookies a long-running browser keeps fresh, for use with other tools
How WebAI2API compares
WebAI2API alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| OmniRoute | ★ 91.4k | A local-first AI gateway that fronts hundreds of model providers with one OpenAI-compatible endpoint, quota-aware auto-fallback, many routing strategies and prompt compression. |
| Free Claude Code | ★ 74.7k | A local proxy that points Claude Code, Codex, Pi, OpenCode, Cline and other agent CLIs at 50 free, paid, subscription or local model providers, with automatic failover and an admin UI. |
| LiteLLM | ★ 64.2k | A Python SDK and proxy server that gives one OpenAI-compatible API to 100+ LLM providers, with cost tracking, budgets, fallbacks, rate limiting, and an admin UI. |
| Kong Gateway | ★ 44.4k | A Lua/NGINX API gateway whose AI Gateway plugins put one universal endpoint in front of OpenAI, Anthropic, Gemini, Bedrock and other providers, with semantic routing, caching and MCP traffic governance. |
| magpie | ★ 43.7k | Menu bar app and local gateway that lets Claude Code, Codex, Gemini CLI and dozens of other coding agents run on any provider's model, with routing groups that fail over across accounts when a quota runs out. |
| 9Router | ★ 33k | Local OpenAI-compatible router for coding CLIs that tracks per-provider quota, falls back from subscription to cheap to free models, and compresses tool results to cut tokens. |
| Experiential | ★ 20.1k | An open-source gateway that puts hosted, BYOK, local and custom models behind one OpenAI-compatible API, with per-identity model and spend limits and routers fitted from your own traces. |
| WebAI2API | ★ 1.4k | A self-hosted server that drives web AI chat sites like LMArena and Gemini in Camoufox browser windows and exposes them as an OpenAI-compatible API |
