Skip to main content

Archive and export your AI chat conversations as JSON and Markdown.

Project description

open-export

PyPI Python License GitHub

Download and archive all your ChatGPT conversations as JSON and Markdown files.


BEFORE YOU USE THIS TOOL, READ THIS.

Why does this tool exist? ChatGPT does not provide an API to export your conversation history. The built-in "Export data" feature emails you a zip file hours later and cannot be automated. Many users on enterprise, university, or managed accounts have this option disabled entirely. This tool gives you a way to programmatically back up your own conversations.

How does it work? It connects to your browser through the Chrome DevTools Protocol (CDP). You open your browser with a special flag (--remote-debugging-port=9222), and the tool reads your ChatGPT data through that browser session. It never sees your password or login credentials.

What is the risk? While port 9222 is open, any program running on your computer can access your browser session -- your cookies, your tabs, your logged-in accounts. This is the same mechanism used by browser developer tools, but it also means malicious software on your machine could exploit it.

How to stay safe:

  1. Only run this tool on a machine you trust
  2. Do not run untrusted software while port 9222 is open
  3. Close your browser completely as soon as the export finishes -- this kills the debugging port
  4. Review the source code yourself: the entire tool is ~400 lines across 4 Python files — view source on GitHub

Installation

pip install open-export

Usage

1. Close all browser windows

Fully quit your browser first (check the system tray on Windows). The debugging flag is ignored if the browser is already running.

2. Relaunch with remote debugging enabled

Edge (Windows):

& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9222

Chrome (Windows):

& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222

Chrome (macOS/Linux):

google-chrome --remote-debugging-port=9222

3. Log into ChatGPT

Navigate to chatgpt.com in that browser window and make sure you're logged in.

4. Run the exporter

open-export -o ./my_chats

Or:

python -m open_export.cli -o ./my_chats

5. Close your browser

Once the export finishes, close all browser windows immediately to shut down the debugging port.

Options

Option Default Description
--output, -o ./open_export_output Output directory
--cdp-url http://localhost:9222 Chrome DevTools Protocol URL
--delay 1.0 Seconds between API requests
--page-size 100 Conversations per page
--verbose, -v off Debug logging
--version Show version

Output

my_chats/
  json/           # Raw API responses (one file per conversation)
  markdown/       # Human-readable formatted conversations

How it works

  1. Connects to your running browser via CDP (connect_over_cdp)
  2. Finds an open ChatGPT tab (or navigates to one)
  3. Fetches an access token from ChatGPT's session endpoint
  4. Paginates through the conversation list API
  5. Downloads each conversation's full data
  6. Exports as JSON (raw) and Markdown (readable)

The access token is used only during the session and cleared from memory on exit. No credentials are stored on disk.

Security details

  • No network calls are made to any server other than chatgpt.com. The tool writes files locally and does not transmit your data anywhere.
  • Fully open source. Every line of code is in this repository.
  • Access tokens are ephemeral. The token is fetched from ChatGPT's own session endpoint, used for the download, and cleared from memory on exit. It is never written to disk or logged.
  • No credentials stored. The tool does not ask for, store, or transmit your username or password.

Development

pip install -e ".[dev]"
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_export-0.1.6.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_export-0.1.6-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file open_export-0.1.6.tar.gz.

File metadata

  • Download URL: open_export-0.1.6.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for open_export-0.1.6.tar.gz
Algorithm Hash digest
SHA256 efde39e5321e6bce9bea75fac255a5aae215251cf9f7585a3fb5c91c84650cc2
MD5 d9c858dc9e33fc62d51eff79db19880a
BLAKE2b-256 92b04553f4f49e52c0aa1b3b536073ec2ea19ee4e3831b89032bd6ee56205fa7

See more details on using hashes here.

File details

Details for the file open_export-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: open_export-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for open_export-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1526ac86e49ceaac537d1811264bb40d32e8c5a2dfd645049eb8965b1e7dabc0
MD5 7daaa3f711d85b9bf7e3b839e6124280
BLAKE2b-256 15357ca37401f218d353bef9518e7c4be36b7d19c54c9488c7398db81903d4a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page