English version. Russian version: README.ru.md
Minimal ChatGPT-style CLI for chatgpt.com that works on your own account.
The project is split into two practical parts:
main.py- the standalone CLI chat with history, streaming, metrics, image prompts, and localization.auth_fetcher.py- browser-basedauth_data.jsoncapture for a real ChatGPT web session.
- streaming replies in the terminal
- latency metrics:
first_token,last_token,total - single local state file:
webchat_state.json - image prompts through
/img autoandwaitauth capture modes- English and Russian CLI localization
main.pyruns without extra Python packages
- Windows
- Python 3.13+
- system
curlavailable inPATH - Chrome or Chromium for
auth_fetcher.py
Create and activate a virtual environment in cmd.exe:
python -m venv venv
venv\Scripts\activate.bat
python -m pip install --upgrade pip
python -m pip install -r requirements.txtmain.py itself does not require external Python packages, but auth_fetcher.py uses g4f and nodriver.
Fast mode for an already logged-in browser session:
venv\Scripts\python.exe auth_fetcher.py --mode autoWait mode if you need time to log in or register first:
venv\Scripts\python.exe auth_fetcher.py --mode waitShort alias for wait mode:
venv\Scripts\python.exe auth_fetcher_wait.pyAfter a successful capture, auth_data.json will appear in the project directory.
python main.pyOr from the virtual environment:
venv\Scripts\python.exe main.py/help/models/new/list/use <chat_id>/reset/img <path_or_url> :: <prompt>/settings/model <name>/lang <en|ru>/ws <true|false>/effort <standard|extended|off>/metrics <true|false>
auth_data.json- local auth data, do not commit itwebchat_state.json- local chat history and runtime settings, do not commit it
auth_data.jsonis the primary auth source..envis optional. If present,accessTokenis used only as a fallback.- Do not mix
cookiesandapi_key/accessTokenfrom different accounts. - If
main.pysays thatcurlis missing, install systemcurl.exeand checkcurl --version.
curlnot found Install systemcurl.exeand make surecurl --versionworks incmd.exe.auth_data.jsonis missing Runvenv\Scripts\python.exe auth_fetcher.py --mode waitand complete login in the browser.- The wrong account opens in
auth_fetcherThe browser profile already contains another session. Log out there first, or use the wait mode and sign in to the intended account. - Requests start failing after working before
Your session cookies or
api_keymay have expired. Regenerateauth_data.json. main.pystarts but cannot answer Check thatauth_data.jsonexists,curlis installed, and the captured browser session still belongs to the same account.
This repository is considered v1: compact, practical, and user-oriented. The app is intentionally kept simple for end users, even though some internals could be split into modules later.