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.5.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.5-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_export-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 72d8baca69fc04917ee7a36c82fd0e6b659dd20f2e81ede372be5a02116a0c31
MD5 e96bdacf9cc00b88c17b4b21be9997a6
BLAKE2b-256 f534d7d6ae1fc3c495c29d8407fd71e59a4c7ffa64b8111eacca2a54230cee22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open_export-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e733c926189baa5e56af841c499cc0330742882836bba821f43c6c711436226f
MD5 09c570d44d89d35ca4b688b028bdc1d9
BLAKE2b-256 55c503a33559287063539066d2c978dd59586be01bb0fbca935264fb87f46f89

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