# acheong08/chatgpt architecture

> Architecture diagram of the GitHub repository acheong08/chatgpt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/acheong08/chatgpt
- Repository: https://github.com/acheong08/chatgpt

## Overview

revChatGPT is a Python client and CLI exposing two ChatGPT interfaces: the reverse-engineered website interface (V1) and the official API interface (V3). Users choose a CLI mode or use either developer API, provide credentials, submit prompts, and receive streamed or single responses. V1 additionally documents conversation management and plugin operations; V3 maintains conversation context and offers optional web-search support. The excerpts show the V3 request and search paths, but not most V1 internals, so V1 subsystem links rely on README documentation and are marked where evidence is limited.

Main entry points: [`src/revChatGPT/V1.py`](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py) (V1 chat client), [`src/revChatGPT/V3.py`](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py) (V3 chat client), [`src/revChatGPT/__main__.py`](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/__main__.py) (Mode launcher), [`src/revChatGPT/typings.py`](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/typings.py) (Types and errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_launcher["Mode launcher<br/>[__main__.py]"]
  node_v1cli["V1 CLI<br/>[V1.py]"]
  node_v3cli["V3 CLI<br/>[V3.py]"]
end

subgraph group_reverse["V1 website client"]
  node_v1chat["V1 chat client<br/>[V1.py]"]
  node_v1auth["V1 authentication<br/>[V1.py]"]
  node_captcha["Captcha handling<br/>[V1.py]"]
  node_v1history["Conversation operations<br/>[V1.py]"]
  node_plugins["Plugin operations<br/>[V1.py]"]
  node_proxy(("V1 proxy service"))
  node_website(("ChatGPT website service"))
end

subgraph group_official["V3 official API"]
  node_v3client["V3 chat client<br/>[V3.py]"]
  node_context["Conversation context<br/>[V3.py]"]
  node_search["Internet search<br/>[V3.py]"]
  node_openai(("OpenAI chat API"))
  node_searchservice(("Search service"))
end

subgraph group_shared["Shared support"]
  node_types["Types and errors<br/>[typings.py]"]
  node_utils["Prompt utilities<br/>[utils.py]"]
  node_version["Version metadata<br/>[version.py]"]
end

node_user(("Developer or CLI user"))

node_user -->|"selects mode"| node_launcher
node_user -->|"runs CLI"| node_v1cli
node_user -->|"runs CLI"| node_v3cli
node_launcher -->|"dispatches V1"| node_v1cli
node_launcher -->|"dispatches V3"| node_v3cli
node_v1cli -->|"runs chat"| node_v1chat
node_v3cli -->|"runs chat"| node_v3client
node_v1chat -->|"requests via"| node_proxy
node_proxy -.->|"forwards requests"| node_website
node_v1chat -.->|"authenticates"| node_v1auth
node_v1chat -.->|"handles challenges"| node_captcha
node_v1chat -.->|"manages conversations"| node_v1history
node_v1chat -->|"supports plugins"| node_plugins
node_v3client -->|"updates context"| node_context
node_v3client -->|"posts completions"| node_openai
node_v3cli -->|"runs search"| node_search
node_search -->|"queries"| node_searchservice
node_search -->|"adds results"| node_context
node_v1chat -->|"imports types"| node_types
node_v3client -->|"imports types"| node_types
node_v1chat -->|"imports utilities"| node_utils
node_v3client -->|"imports utilities"| node_utils
node_launcher -->|"reads version"| node_version

click node_launcher "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/__main__.py"
click node_v1cli "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_v3cli "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py"
click node_v1chat "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_v1auth "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_captcha "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_v1history "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_plugins "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py"
click node_v3client "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py"
click node_context "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py"
click node_search "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py"
click node_types "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/typings.py"
click node_utils "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/utils.py"
click node_version "https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/version.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launcher,node_v1cli,node_v3cli,node_user toneBlue
class node_v1chat,node_v1auth,node_captcha,node_v1history,node_plugins,node_proxy,node_website toneAmber
class node_v3client,node_context,node_search,node_openai,node_searchservice toneMint
class node_types,node_utils,node_version toneRose
```

## Components

### User entry points

- [Mode launcher](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/__main__.py): `src/revChatGPT/__main__.py`
- [V1 CLI](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- [V3 CLI](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py): `src/revChatGPT/V3.py`

### V1 website client

- [V1 chat client](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- [V1 authentication](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- [Captcha handling](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- [Conversation operations](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- [Plugin operations](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V1.py): `src/revChatGPT/V1.py`
- **V1 proxy service**
- **ChatGPT website service**

### V3 official API

- [V3 chat client](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py): `src/revChatGPT/V3.py`
- [Conversation context](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py): `src/revChatGPT/V3.py`
- [Internet search](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/V3.py): `src/revChatGPT/V3.py`
- **OpenAI chat API**
- **Search service**

### Shared support

- [Types and errors](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/typings.py): `src/revChatGPT/typings.py`
- [Prompt utilities](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/utils.py): `src/revChatGPT/utils.py`
- [Version metadata](https://github.com/acheong08/chatgpt/blob/main/src/revChatGPT/version.py): `src/revChatGPT/version.py`

### Other components

- **Developer or CLI user**

## Connections

- Developer or CLI user → Mode launcher: selects mode (evidence: `src/revChatGPT/__main__.py`)
- Developer or CLI user → V1 CLI: runs CLI
- Developer or CLI user → V3 CLI: runs CLI
- Mode launcher → V1 CLI: dispatches V1 (evidence: `src/revChatGPT/__main__.py`)
- Mode launcher → V3 CLI: dispatches V3 (evidence: `src/revChatGPT/__main__.py`)
- V1 CLI → V1 chat client: runs chat (evidence: `src/revChatGPT/V1.py`)
- V3 CLI → V3 chat client: runs chat (evidence: `src/revChatGPT/V3.py`)
- V1 chat client → V1 proxy service: requests via
- V1 proxy service → ChatGPT website service: forwards requests
- V1 chat client → V1 authentication: authenticates (evidence: `src/revChatGPT/V1.py`)
- V1 chat client → Captcha handling: handles challenges (evidence: `src/revChatGPT/V1.py`)
- V1 chat client → Conversation operations: manages conversations (evidence: `src/revChatGPT/V1.py`)
- V1 chat client → Plugin operations: supports plugins (evidence: `src/revChatGPT/V1.py`)
- V3 chat client → Conversation context: updates context (evidence: `src/revChatGPT/V3.py`)
- V3 chat client → OpenAI chat API: posts completions (evidence: `src/revChatGPT/V3.py`)
- V3 CLI → Internet search: runs search (evidence: `src/revChatGPT/V3.py`)
- Internet search → Search service: queries (evidence: `src/revChatGPT/V3.py`)
- Internet search → Conversation context: adds results (evidence: `src/revChatGPT/V3.py`)
- V1 chat client → Types and errors: imports types (evidence: `src/revChatGPT/V1.py`)
- V3 chat client → Types and errors: imports types (evidence: `src/revChatGPT/V3.py`)
- V1 chat client → Prompt utilities: imports utilities (evidence: `src/revChatGPT/V1.py`)
- V3 chat client → Prompt utilities: imports utilities (evidence: `src/revChatGPT/V3.py`)
- Mode launcher → Version metadata: reads version (evidence: `src/revChatGPT/__main__.py`)
