Amm1rr/WebAI-to-API

Webchat to API

What it is

WebAI‑to‑API is a small self‑hosted service that runs inside your own machine (or Docker container) and forwards requests to Google Gemini models. It presents the familiar /v1/chat/completions OpenAI‑style endpoints, so any client that talks to OpenAI can be pointed at it.

Core features

  • OpenAI‑compatible chat endpoint (/v1/chat/completions) with streaming (SSE) support
  • Provider‑based architecture – currently ships with a Gemini provider that can talk to Gemini either via the official WebAPI or via a Playwright‑driven browser runtime
  • Stateless “Hermes” mode where the client owns the full conversation history (no server‑side SQLite snapshots)
  • Health (/health) and readiness (/ready) probes plus runtime diagnostics (/v1/runtime/status)
  • Simple web dashboard (/ui) for status, authentication, model discovery and a playground
  • Docker‑first deployment; also runnable directly with Poetry
  • No built‑in caller authentication – intended for localhost or behind your own firewall

Quick‑start (Linux/macOS)

# 1. Clone & install
git clone https://github.com/Amm1rr/WebAI-to-API.git
cd WebAI-to-API
./install.sh   # installs deps, Poetry, Playwright Chromium, creates config

# 2. Authenticate to Gemini (browser login or cookie cache)
poetry run python verify_login.py

# 3. Run the server
poetry run python src/run.py

The API will be reachable at http://localhost:6969 and the dashboard at http://localhost:6969/ui.

Docker deployment

git pull
APP_UID=$(id -u) APP_GID=$(id -g) docker compose up -d --build

Docker images expose the same endpoints and include the same authentication helpers.

Making a request

curl -X POST http://localhost:6969/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
        "model": "gemini-3-flash",
        "messages": [{"role": "user", "content": "Hello!"}]
      }'

The response follows the OpenAI chat schema; streaming works via Server‑Sent Events.

Provider & model routing

  • gemini-3-flash – uses the configured Gemini backend (webapi or playwright).
  • playwright/gemini-3-flash – forces the Playwright‑based browser runtime.
  • The endpoint /v1/models returns the live catalog, e.g. gemini-3-flash and playwright/gemini-3-flash.

Configuration basics

Settings live in config.conf (INI format). Key sections:

[Gemini]
backend = webapi          # or "playwright"
default_model = gemini-3-flash
extended_thinking = false

Proxy, logging, and additional provider options are also configurable; environment variables are read from .env.

Security note

The service does not enforce API keys. Keep it bound to localhost or place it behind a reverse‑proxy that adds authentication if you expose it externally.

Documentation & help

  • Installation, configuration, and update guides live under docs/
  • Swagger UI (/docs) provides interactive API docs once the server is running
  • The dashboard (/ui) shows runtime health, authentication status, and lets you test calls.

License

MIT – free to use, modify, and redistribute.

Related

  • Project
  • Project
  • Project
  • Project
  • Project