Skip to main content

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

Project description

open-export

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 in this repository

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.3.tar.gz (10.3 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.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_export-0.1.3.tar.gz
  • Upload date:
  • Size: 10.3 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.3.tar.gz
Algorithm Hash digest
SHA256 ae2fd89509cd3358e0b44f2f109d73d1008b70f2a549b764fd16a9f5b4459242
MD5 f88a9e193365fa77d66c13b1bede384b
BLAKE2b-256 4a43bca0e71a588bb0afdb9d21e050dfa8bca18547ba4d64e7741440cc77bbca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open_export-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5f5581976373a190404f45c37e370be0fc30ee98896a13bc85fb39aaa9456a17
MD5 69305bc592d185d4456f5dfce97ed3ee
BLAKE2b-256 0611efad4468ed3c28375764b6122ded2183e2835ffc075cdc5a4fdef6578e71

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