Skip to content
Projects

About

一键在2026年部署支持最新模型的ChatGPT镜像站Deploy a ChatGPT mirror site supporting the latest models with a single click in 2026🪐

AI & Machine Learning

How these counts are measured

Measured star growth

in 24h
+3
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

ChatGPT Mirror — Self-Host a ChatGPT Mirror with Docker

ChatGPT Mirror is a web mirror of ChatGPT for personal learning and research. You can manage multiple ChatGPT accounts and account pools from one dashboard. Each mirror user has their own conversations, projects, and Library files.

Docker Compose quick start · Screenshots and demos · Accounts and account pools · 简体中文

Features

Feature Description
User management and account pools Group upstream ChatGPT accounts into pools and assign them to mirror users. Check credential status and manage proxy nodes from the dashboard.
Conversation, project, and file isolation Keep chats, projects, and files separate for each mirror user. The app checks Library file ownership when users list, search, preview, download, or delete files.
Account quotas and health checks See remaining quotas, account load, model details, and login counts. The app checks accounts on a schedule and sends email alerts via SMTP if it finds invalid credentials.
Automated account linking and token refresh Sign in to ChatGPT from the dashboard's embedded sign-in page. ChatGPT Mirror imports the credentials automatically and lets you refresh tokens later. Automated linking requires curl-impersonate.
Access controls and logs Control access to upstream settings and Dot. Review usage and failed sign-ins. A countdown shows when users can try signing in again.
Languages and themes The sign-in page and admin dashboard support English and Simplified Chinese, as well as light and dark themes.

Deploy ChatGPT Mirror with Docker Compose

You need Docker Engine and Docker Compose v2 on an AMD64 or ARM64 host. For public deployments, configure HTTPS on your domain.

LAN access over HTTP · HTTPS reverse proxy · Update and keep your data · Container status and logs

1. Get the deployment files

git clone https://github.com/Jasa-Chi-Ray/chatgpt-mirror.git
cd chatgpt-mirror
cp .env.example .env

The Docker Compose configuration pulls three prebuilt images from a registry. Docker automatically selects the image for your CPU architecture. Source code for the gateway and Cloudflare helper remains unpublished.

Service Docker image
Gateway and admin frontend lisa666520/chatgpt-mirror:latest
Admin backend lisa666520/chatgpt-mirror:backend
Cloudflare helper lisa666520/chatgpt-mirror:cfbypass

2. Configure the administrator account and secrets

Edit .env using the environment variable template. Set a strong admin password and generate a separate random value for each of the three secrets. Keep your existing values when updating a deployment.

ADMIN_USERNAME=admin
ADMIN_PASSWORD=replace-with-a-strong-password
GATEWAY_ADMIN_SECRET=replace-with-a-random-secret
DJANGO_SECRET_KEY=replace-with-a-different-random-secret
CREDENTIAL_ENCRYPTION_KEY=replace-with-a-random-key-of-at-least-32-characters

Run openssl rand -hex 32 once for each secret.

3. Start the containers

docker compose config --quiet
docker compose pull
docker compose up -d
docker compose ps

By default, the mirror is at http://SERVER_IP:40002/ and the admin dashboard is at http://SERVER_IP:40002/admin/. For public access, use the domain from your HTTPS reverse proxy configuration.

Local and LAN access over HTTP

The example configuration allows HTTP access from other devices on the local network by default.

BIND_ADDRESS=0.0.0.0
LOCAL_NETWORK_ACCESS=enable

This mode relaxes the Host, Origin, and Referer checks and removes the Secure attribute from cookies for HTTP access. CSRF tokens and sign-in authentication still apply. From another device on the LAN, visit the server at its LAN address, such as http://192.168.x.x:40002/.

HTTPS reverse proxy setup with NGINX and Cloudflare

Replace example.com with your domain and forward requests from the reverse proxy to the gateway on port 40002. Django and the Cloudflare helper communicate over the Docker network.

LOCAL_NETWORK_ACCESS=disable
DJANGO_ALLOW_ALL_ORIGINS=disable
DJANGO_ALLOWED_HOSTS=example.com,django,localhost,127.0.0.1
DJANGO_CSRF_TRUSTED_ORIGINS=https://example.com
DJANGO_SESSION_COOKIE_SECURE=true
DJANGO_CSRF_COOKIE_SECURE=true
COOKIE_SECURE=true

Enable WebSocket support and disable proxy buffering so responses can stream. In NGINX Proxy Manager, turn on WebSocket support in the interface and add the following settings under Advanced as needed.

proxy_buffering off;
proxy_read_timeout 300s;
proxy_buffer_size 128k;
proxy_buffers 8 128k;
proxy_busy_buffers_size 256k;
large_client_header_buffers 8 64k;
client_header_buffer_size 64k;

The header buffer settings can help with errors such as 400 Request Header Or Cookie Too Large, 414 Request-URI Too Large, and upstream sent too big header. For client IP configuration, see the networking and reverse proxy FAQ in Chinese.

Update ChatGPT Mirror and keep existing data

docker compose pull
docker compose up -d

Keep the original .env, the gateway data in data/, the admin service data in backend/db/, and any logs you want to retain in backend/logs/. Keep the original CREDENTIAL_ENCRYPTION_KEY so the app can still decrypt stored account credentials.

After updating, open Upstream accounts and select Check all to verify plans and credential status.

Updates preserve your saved transport mode. Before using automated linking, open Proxy, make sure the third option, curl-impersonate (Stable · Default), is selected, and save the configuration.

Container status and logs

docker compose ps
docker compose logs -f --tail 100
docker compose down

Manage ChatGPT accounts and account pools

Dashboard area What you can manage
Users User status, model quotas, file isolation, and access expiration
Upstream accounts Add, update, and check accounts. See plans, credential status, time until access tokens expire, and model quotas
Automated linking Connect accounts, import credentials, and refresh tokens through the embedded sign-in page
Account pools Group upstream accounts into pools and assign them to mirror users
Access logs Review access history, failed sign-in attempts, and client IP addresses. The logs hide parameter values
Proxy management Configure proxy nodes and test connectivity
Scripts Manage custom scripts for the site
Access and security Control access to upstream settings and Dot separately
Health checks Check upstream accounts on a schedule and send email alerts via SMTP when a check finds a problem

Link a ChatGPT account from the dashboard

Automated linking requires the third transport option, curl-impersonate (Stable · Default). New deployments use it by default. On an existing deployment, check the selection under Proxy and save the configuration before linking an account.

  1. Open Automated linking in the admin dashboard and click 录入连接 (Add connection).
  2. In the embedded window, sign in to a ChatGPT account you're authorized to use and follow the verification prompts.
  3. After a successful sign-in, the window closes automatically and the account appears under Upstream accounts. If the account already exists, you'll be asked whether to replace the existing entry.
  4. Under Upstream accounts, check the plan, credential status, and remaining quota. For linked accounts, select Update tokens. The sign-in window opens if you need to authenticate again. For accounts you added manually, use the account form to update the credentials.

When you disconnect an account, you can also delete it from Upstream accounts. The checkbox is unchecked by default. Deleting an upstream account directly also removes its automated connection.

Screenshots and demos

ChatGPT chat interface

ChatGPT chat interface in the self-hosted mirror

Sign-in and account selection

The video shows the new sign-in flow, account cards, and status messages. The screenshot shows the previous sign-in page.

https://github.com/user-attachments/assets/241373b4-d7c2-47e9-b740-58020bcdcf09

Previous ChatGPT Mirror sign-in page

Admin dashboard and account pools

The video shows where to find accounts, account pools, logs, and access settings in the dashboard.

https://github.com/user-attachments/assets/19174496-7c4f-4475-a70f-a6345328fde0

Automated account linking

The video shows how to sign in from the admin dashboard and import the ChatGPT account into the mirror.

https://github.com/user-attachments/assets/a1cf80ff-931f-4f8f-9e71-cfe2b6616603

Switching languages (Chinese and English) and themes (light and dark)

https://github.com/user-attachments/assets/9464e301-3715-465d-8673-76ac1a6e1a60

Access to upstream settings and Dot

The current dashboard has one switch that controls access to upstream settings and a separate switch for Dot. The screenshot shows the previous interface, where access was configured by path.

Path-based access controls in an earlier version of the ChatGPT Mirror dashboard

Admin dashboard demo (older version)

https://github.com/user-attachments/assets/07069457-27af-4b66-91ec-735703340abf

Watch the original ChatGPT Mirror walkthrough on GitHub

Cloudflare helper (cfbypass 2.0)

For routine requests, the helper uses its lightweight request engine by default. It starts a browser automatically when it needs to run JavaScript and can reuse that browser across tasks. The browser closes automatically when idle to reduce resource use.

In one deployment, the lightweight engine obtained a cookie in about 214 ms, and the first warm-up succeeded. Timing depends on the network, proxy, and type of verification.

Model behavior and interface compatibility tests

Model fingerprint checks for the current version

The results below are for reference. The tests used curl-impersonate.

Watch a demo of the GPT-6.0 Astra fingerprint test

Screenshot of the GPT-6.0 Astra model fingerprint test

Screenshot of the GPT-6.2 Sol model fingerprint test

Follow-up model behavior tests and ChatGPT Intelligent UI screenshots

The earlier tests used an IP address assigned in Japan. Response quality can vary with the upstream model, account status, and network conditions. In the current version, curl-impersonate is the default stable mode, Wreq is marked unstable, and reqwest is deprecated.

Screenshot from the August 26, 2026 model behavior test

First follow-up test of model behavior

Second follow-up test of model behavior

Follow-up test of GPT Astra

Follow-up model test after project isolation was added

Transport mode selector in an earlier version

GPT-6 series in ChatGPT Intelligent UI

Repository structure

chatgpt-mirror/
├── backend/              # Users, upstream accounts, account pools, and health checks
├── frontend/             # Sign-in page, themes, and admin dashboard
├── imageandvideo/        # README screenshots and demo videos
├── .env.example          # Environment variable template
├── docker-compose.yml    # Deployment configuration for prebuilt images
├── FAQ.md                # Full FAQ in Chinese
├── README.md             # Default README in Simplified Chinese
└── README.en.md          # English README

Usage and licensing

Use the project only with accounts and in environments you are authorized to use. Follow the upstream service's terms and applicable local laws and regulations.

The project is for personal learning, research, and other non-commercial uses only. The project and any modified versions may not be used for paid services, commercial operations or deployments, resale, paid hosting, or any other direct or indirect profit-making activity. Commercial use requires the author's prior written permission.

Changelog

2026-11

  • The helper now tries the lightweight request engine first, reuses browser processes when needed, and shuts them down when idle. Cloudflare cookie warm-up runs in the background. Routine HTTP and WebSocket requests no longer start the verification browser themselves.
  • Improved fallback handling when using the official sign-in page. Regular chats still use the transport mode selected in the dashboard. The gateway reuses connections and cached authorization data. It follows upstream caching rules when loading DIL resources.
  • Added support for updated reply components and cloud-hosted DIL. Fixed replies that would not load, chat history missing after a refresh, and failed file uploads in chats. Also fixed cases where new pop-ups interrupted chats or restrictions on settings kept users from continuing a chat.
  • Redesigned sign-in, registration, account selection, and dashboard navigation. Added English and Chinese language options and light and dark themes. Improved plan labels, status messages, and the sign-in countdown.
  • Added automated account linking, a confirmation prompt for reimporting an existing account, and token refresh with reauthentication when needed. Quota and load checks now run at different times for different accounts. Admins can expand the results to see details for each model.
  • Made curl-impersonate the default stable mode for new deployments. Marked Wreq as unstable and reqwest as deprecated. AMD64 and ARM64 images use the same latest, backend, and cfbypass tags.
  • Fixed an issue that misclassified Pro plans, including standard Pro, Pro Lite, and Pro Max, as Free. If a credential check fails, the app keeps the last known valid plan.
  • Added a dedicated Dot access switch. It blocks Dot pages, APIs, and message rooms by default. Improved Library file ownership checks for listing, searching, previewing, downloading, and deleting files. The Library entry has its own visibility setting.
  • Updated the sign-out flow, including revocation and session cleanup. If user data isolation fails to initialize, the page shows a five-second countdown, then clears the mirror's cookies and reloads.
  • Improved tracking of failed sign-ins and the 120-second cooldown. Valid sessions stay active. Other users behind the same NAT do not enter a cooldown solely because they share an IP address. Logs mask parameter values and cookies. The app now identifies client IPs more reliably behind reverse proxies.
  • Added optional Linux DO sign-in, which is off by default. Fixed Deep Research display, text loading, and component layout issues. Also fixed issues with token retrieval, privacy, security, and component compatibility.
View changes from October 2026 and earlier

2026-10

  • Added project isolation and support for the GPT-6 series and ChatGPT Intelligent UI. Adjusted the new interface to reduce its impact on model behavior and improve component compatibility.
  • Updated how cfbypass 2.0 handles Cloudflare Turnstile. To use this update, also update your Docker Compose configuration.
  • Fixed an infinite refresh loop in refresh_account (reported by Cznorth), issues with some Team accounts (reported by I0amLK), and unexpected sign-outs when multiple tabs were open (reported by asdfank).

2026-09

  • Added security features, fixed the session isolation vulnerability reported by xiaolongmr, and retested the fix.
  • Added isolation for MCP, Skills, and models, along with per-model rate limits.
  • Added SMTP email alerts when scheduled checks find accounts with invalid credentials.

2026-08

  • Improved Safari and Chrome compatibility on iPhone, addressing intermittent request failures and resource parsing warnings.
  • Added sensitive-word detection, Markdown support for announcements, and a configurable list of trusted domains for scripts.
  • Added reqwest, Wreq, and the experimental curl-impersonate transport. Improved proxy routing and verification request handling. Updated model behavior tests and the workarounds for issues affecting Pro accounts.

2026-07

  • Restricted credential output and sensitive logging, tightened admin permissions and redirect validation, and hardened production settings.
  • Expanded user isolation for shared upstream accounts to cover conversations, archives, search, titles, and deletion. Limited the effects of shared memory across users.
  • Improved static asset and chart loading. Fixed intermittent cache issues and missing artifacts during container builds.

2026-06

  • Added scheduled credential refresh, concurrency safeguards, on-demand refresh, and a time-to-expiry indicator.
  • Improved mobile compatibility for chat loading and real-time connections.

2026-05 and earlier

  • Initial development.

Star history

GitHub star history for ChatGPT Mirror

Explore related projects

Loading…