rawandahmad698/PyChatGPT

⚡️ Python client for the ChatGPT API with, conversation tracking, proxy support and more.

What it solves

PyChatGPT is a Python library that allows users to interact with ChatGPT without needing a browser or manually extracting access tokens. It solves the problem of automating ChatGPT interactions by reverse-engineering the API to mimic a real user, bypassing bot detection and automating the login process.

How it works

The library uses a TLS client to mimic a real user's browser behavior to bypass Auth0 bot detection. It manages the entire authentication flow—including handling JWT state tokens to prevent CSRF attacks—to automatically log in and retrieve an access token. This token is then saved to a file to avoid repeated logins and is automatically refreshed when it expires.

Who it’s for

Developers who want to integrate ChatGPT capabilities into their own Python projects or use a CLI-based chat interface without the overhead of a Chromium instance or manual token management.

Highlights

  • Automated Authentication: Automatically logs in and retrieves access tokens without a browser.
  • Conversation Management: Ability to save conversations to files and resume them later using conversation IDs.
  • Session Customization: Customizable options for logging, proxy support, and moderation bypass.
  • Robust Token Handling: Saves and automatically refreshes access tokens to ensure continuous access.
  • CLI Interface: Includes a built-in CLI session for quick interaction.

Related

  • Project
  • Project
  • Project
  • Project
  • Project