explaingit

zqbxdev/webchat2api

Analysis updated 2026-06-24

62PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

Proxy that wraps the ChatGPT and Grok web chat interfaces behind an OpenAI-style API, with a Next.js admin panel for managing accounts, keys, and image jobs.

Mindmap

mindmap
  root((webchat2api))
    Inputs
      ChatGPT web logins
      Grok web logins
      Bearer API keys
    Outputs
      OpenAI v1 chat completions
      Image generations
      Model list endpoint
    Use Cases
      Reuse paid chat accounts via API
      Self host OpenAI compatible gateway
      Rotate image accounts
    Tech Stack
      FastAPI
      Next.js
      Docker
      Postgres or SQLite
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Call your ChatGPT or Grok web sessions from code using OpenAI-compatible endpoints.

USE CASE 2

Self-host an admin panel that pools and rotates GPT and Grok accounts for image jobs.

USE CASE 3

Front your own tools with a single Bearer-token API that hides which chat backend is used.

What is it built with?

PythonFastAPINext.jsDockerSQLitePostgres

How does it compare?

zqbxdev/webchat2apiblue-pen5805/comfyui-krea2-negpipfrayude/throttnux
Stars626163
LanguagePythonPythonPython
Setup difficultymoderatemoderatemoderate
Complexity3/52/53/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Needs Docker plus valid ChatGPT or Grok web session tokens imported into the account pool before any API call works.

In plain English

webchat2api is a proxy server that takes the browser-based chat interfaces of ChatGPT and Grok and exposes them as a standard OpenAI-style API. The idea is that if you already have a web login for ChatGPT or Grok, this project lets you call those chats from your own code using the same endpoints that other tools use to talk to the official OpenAI API, things like /v1/models, /v1/chat/completions, and /v1/images/generations. The README opens with a clear warning. The project is reverse-engineering the web chat experience, and it is meant for personal learning and non-commercial technical exploration. The author tells users not to use it for reselling or any large-scale abuse, and to accept that accounts may get rate-limited or banned. There is also a security note that the default login password is admin, which is only fine for local testing. For any public deployment you have to set a strong LOGIN_SECRET or WEBCHAT2API_AUTH_KEY. The stack is FastAPI on the backend and a Next.js admin web app on top of it. The admin panel manages a pool of GPT and Grok accounts, user API keys, proxy settings, logs, image jobs, files, and overall system config. There is also a playground page for trying chat and image generation, with separate text-to-image and image-to-image modes, plus an image queue and history. When generating images, if one account fails the service rotates to the next available one. Getting started is built around Docker. You clone the repo, build the image, and run a docker container that exposes port 83 with a data volume for persistence. There is a second example that adds a proxy URL pointing to the host machine, useful when you need to tunnel out through your own network. Docker Compose is also supported, and there are commands for local development with uv for the Python side and npm run dev for the web frontend. The API examples in the README show how to call /health, list models, chat, and generate images using a Bearer token. Configuration lives in a .env file and a config.json that you copy from the example. Storage can be plain JSON files, SQLite, Postgres, or even Git as a backend. The data folder holds accounts, keys, logs, and image tasks, and the README is firm that this folder must never be committed to version control.

Copy-paste prompts

Prompt 1
Walk me through deploying webchat2api on a fresh VPS with Docker Compose and a strong LOGIN_SECRET.
Prompt 2
Show me a Python script that calls webchat2api /v1/chat/completions and falls back from Grok to GPT on errors.
Prompt 3
Help me switch webchat2api storage from JSON files to Postgres and migrate existing accounts.
Prompt 4
Write a small CLI that imports a list of Grok access tokens into webchat2api via the admin API.

Frequently asked questions

What is webchat2api?

Proxy that wraps the ChatGPT and Grok web chat interfaces behind an OpenAI-style API, with a Next.js admin panel for managing accounts, keys, and image jobs.

What language is webchat2api written in?

Mainly Python. The stack also includes Python, FastAPI, Next.js.

How hard is webchat2api to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is webchat2api for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.