Exporting ChatGPT chats to SillyTavern

with character names and corrected timestamps - ideal for use with the Qdrant RAG Memory Extension


1. Install the exporter
  1. Add the Tampermonkey browser extension:
    https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
  2. Install ChatGPT Exporter:
    https://github.com/pionxzh/chatgpt-exporter
  3. Go to Extensions > Manage Extensions, find Tampermonkey > Details, and enable “Allow user scripts.”
  4. Reload ChatGPT. You should now see an Export button at the bottom left of the page above your username.
2. To export:
  1. Open the conversation you want.
  2. Click Export > JSON > JSONL (TavernAI, SillyTavern). For this guide we’ll assume the file is saved as export.jsonl.

2. Fix timestamps and character names

This will add the name of the character and fix the dates, or else every chat imports as "January 1970" and the characters become "Assistant" and "User".

Alternative:

SillyTavern can rename the assistant internally. You can rename the character directly and it will offer to update all previous chats automatically. That fixes the names but not the dates.
If you prefer to do this and don't care about dates you can skip the whole python thing.
I highly recommend taking advantage of the date fix for memory storage though.


3. Install Python

Download and install from https://www.python.org/downloads/


4. Create the script

Open Python’s IDLE or any text editor, create a new file and paste the code below. Replace the names with yours (USER_NAME) and your AI's (AI_NAME), and the chat names (input and output files) if desired.
Save it as add_timestamps.py in the same folder as your exported chat.

import json
from datetime import datetime

INPUT_FILE = "export.jsonl"
OUTPUT_FILE = "export_with_dates.jsonl"

with open(INPUT_FILE) as f_in, open(OUTPUT_FILE, "w") as f_out:
    for line in f_in:
        msg = json.loads(line)

        # Fix send_date and add readable date
        if "send_date" in msg:
            if msg["send_date"] < 1000000000000:  # seconds → milliseconds
                msg["send_date"] *= 1000
            msg["date"] = datetime.fromtimestamp(msg["send_date"] / 1000).strftime("%Y-%m-%d")

        # Replace every "You" (case sensitive) with "USER_NAME"
        # Works even inside quoted text
        msg_str = json.dumps(msg, ensure_ascii=False)
        msg_str = msg_str.replace('"You"', '"USER_NAME"')  # replaces the quoted form
        msg_str = msg_str.replace('"Assistant"', '"AI_NAME"')  # replaces the quoted form

        f_out.write(msg_str + "\n")

print("✅ send_date corrected, human-readable dates added, and names replaced.")

Step-by-Step on Windows or macOS
  1. Create the file

Option A - Using IDLE (comes with Python):

Open IDLE from your start menu or applications folder.

Click File > New File.

Paste the Python code above into the blank window.

Click File > Save As…, name it add_timestamps.py, and save it in the same folder as your exported .json file (for example, Downloads).

Option B - Using a text editor:

Open a text editor such as Notepad, TextEdit, VS Code, or Sublime.

Paste the code.

Save it as add_timestamps.py (make sure the extension is .py, not .txt), in the same directory as your chat export.

  1. Place the export

Make sure your export file (e.g., export.json) is in that same folder.
If it has a different name, either rename it to export.json or edit the line in the script:

INPUT_FILE = "your_filename.json"

Run the script

Windows:

Open the Start menu and type “cmd”, then press Enter.

Use cd to go to the folder where the files are, for example:

cd USERPROFILE\Downloads

Run:

python add_timestamps.py

macOS / Linux:

Open Terminal.

Use cd to navigate to the folder:

cd ~/Downloads

Run:

python3 add_timestamps.py

Check the result

When it finishes, you’ll see:

✅ send_date corrected, human-readable dates added, and names replaced.

That new file will appear in the same folder - now every message has a timestamp field that SillyTavern or Qdrant can read, and proper character names.


6. Import into SillyTavern
  1. Open SillyTavern and select your character.
  2. Click the three-line menu in the bottom left > Manage Chat Files > Import Chat.
  3. Choose your new file. (Version 1.13.5+ supports importing multiple chats at once.)

Done

Optional steps:


7. Batch process all exported chats

If you’ve exported many .jsonl chats and want to convert them all in one go, you can use this one-liner instead of editing each file manually.
Place this in the same folder as your add_timestamps.py script and all your .jsonl exports, then run it in the terminal.

Windows (PowerShell):

Get-ChildItem *.jsonl | ForEach-Object { python add_timestamps.py $_.Name }

macOS / Linux (bash / zsh):

for f in *.jsonl; do python3 add_timestamps.py "$f"; done

Each file will be processed in sequence, producing matching output files (for example, export_with_dates_<originalname>.jsonl if you prefer to use the script to rename automatically).

8. Auto-naming version of add_timestamps.py

This variant processes either a single file or, when used with the one-liner batch commands, automatically names each output file as filename_with_dates.jsonl.

import json
import sys
from datetime import datetime
from pathlib import Path

# Detect file name (either passed by batch script or default)
if len(sys.argv) > 1:
    INPUT_FILE = sys.argv[1]
else:
    INPUT_FILE = "export.jsonl"

input_path = Path(INPUT_FILE)
OUTPUT_FILE = input_path.stem + "_with_dates.jsonl"

with open(INPUT_FILE) as f_in, open(OUTPUT_FILE, "w") as f_out:
    for line in f_in:
        msg = json.loads(line)

        # Fix send_date and add readable date
        if "send_date" in msg:
            if msg["send_date"] < 1000000000000:  # seconds → milliseconds
                msg["send_date"] *= 1000
            msg["date"] = datetime.fromtimestamp(msg["send_date"] / 1000).strftime("%Y-%m-%d")

        # Replace quoted character names
        msg_str = json.dumps(msg, ensure_ascii=False)
        msg_str = msg_str.replace('"You"', '"USER_NAME"')
        msg_str = msg_str.replace('"Assistant"', '"AI_NAME"')

        f_out.write(msg_str + "\n")

print(f"✅ Processed {input_path.name}{OUTPUT_FILE}")

Example workflow

macOS / Linux:

for f in *.jsonl; do python3 add_timestamps.py "$f"; done

Windows (PowerShell):

Get-ChildItem *.jsonl | ForEach-Object { python add_timestamps.py $_.Name }

You’ll end up with tidy pairs like:

chat1.jsonl > chat1_with_dates.jsonl
chat2.jsonl > chat2_with_dates.jsonl

Each output keeps the same formatting, adds readable timestamps, and replaces character names - fully ready for bulk import into SillyTavern.

Edit

Pub: 02 Nov 2025 01:12 UTC

Edit: 02 Nov 2025 03:58 UTC

Views: 170