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 - atomic writes for local state and
auth_data.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, zendriver, and platformdirs.
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 waitOptional: override the one-shot probe prompt used to trigger auth capture:
venv\Scripts\python.exe auth_fetcher.py --mode auto --probe-prompt "Ping"Short 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 as a fallback even whenauth_data.jsonis missing, but a fullauth_data.jsonremains the most compatible setup.auth_fetcher.pysends one probe message to trigger capture. The default text is"Hello", and you can override it with--probe-prompt.- Do not mix
cookiesandapi_key/accessTokenfrom different accounts. - Local state and auth files are written atomically to reduce the chance of truncated JSON after interruption.
- 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.ImportError: cannot import name 'nodriver'Reinstall dependencies withpython -m pip install -r requirements.txt. Recentg4freleases usezendriverinstead of the oldernodriverpackage name.- 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 now considered stable v1: compact, practical, and user-oriented.
The scope of this repo remains the end-user CLI plus browser auth capture. Future reusable transport or adapter work is expected to move into a separate repository such as webchat-adapter, so this project can stay focused and low-maintenance.