PyChatGPT is a Python package that talks to the ChatGPT API with conversation tracking, proxy support, and saved credentials. It can log in without driving a visible browser session.
Overview
PyChatGPT automates access to ChatGPT's web API from Python programs. It gathers and refreshes access tokens, can persist them to disk, and supports resuming chats after the program exits by saving conversations to files.
Session options include proxies, optional moderation bypass behavior, colored terminal output, and smart conversation tracking that returns answers with conversation identifiers. You can run an interactive CLI, ask one-off questions, or import the module into other projects.
Authentication is implemented as a multi-step TLS client flow rather than manual browser inspection, with notes on rate limits, captchas, VPNs, and proxy use when token creation fails. A Gradio web demo on Hugging Face Spaces is referenced for interactive trials.
The package is distributed via pip under the chatgptpy name and documents changelog entries around API action parameters, error handling, and moderation endpoints.
Key features
- Saved and resumed conversations
- Proxy-capable TLS login flow
- Persisted access token refresh
- Interactive CLI sessions
- Importable Python module API
- Optional moderation handling
- Conversation ID tracking
- Colorized terminal output
Use cases
- Scripted ChatGPT Q&A
- Long-running chat automation
- Projects embedding ChatGPT access
- Proxy-only network environments