Background and Motivation
Google AI Studio offers an excellent conversation experience. However, in research or daily note-taking, we often face the challenge of data retention. The native interface does not provide an export option.
If you want to save inspiration, organize code snippets, or back up team collaboration content, copying and pasting item by item is clearly too inefficient. Such repetitive work should not take up valuable time.
To that end, a Tampermonkey user script was written: AI Studio Chat Exporter. It aims to solve this pain point by enabling one-click packaging of conversation content.
Feature Overview
The script mainly implements the following features to simplify the data acquisition process:
-
One-click export After the page loads, a floating “Export JSON” button appears on the screen. Click it to package the current chat content into a JSON file and download it.
-
Complete capture The script automatically handles the page’s scroll loading. This ensures that every turn of the conversation — whether user input or model replies — is fully captured, avoiding omissions that may occur with manual copying.
-
System prompt extraction The System Prompt often defines the tone and rules of the conversation. Even if the sidebar is collapsed, the script automatically expands it and captures this key information.
-
Markdown format support Elements such as headings, lists, and code blocks in the model output are converted to standard Markdown format. This allows the exported content to be pasted directly into note-taking software or blogs without further formatting.
-
Multi-language support The interface prompts support Simplified Chinese, English, German, and other languages, switching automatically based on the browser’s language settings.
Deployment
Using this script requires browser extension support.
-
Environment preparation Install the Tampermonkey (油猴) extension in browsers such as Chrome, Edge, or Brave.
-
Script installation Obtain the
script.jsscript file or link. Tampermonkey will automatically recognize it and show the installation dialog — just click “Install”. Install here -
Permission confirmation Make sure the script’s match rules cover the
https://aistudio.google.com/prompts/*domain. -
Verification Refresh the AI Studio conversation page. If a draggable blue button appears at the top of the page, the installation was successful.
Usage
The workflow is very straightforward:
- Open any AI Studio conversation project.
- Find the floating button and drag it to a position that doesn’t block your view.
- Click the button. The script will automatically perform the following operations:
- Fetch the system prompt (System Instruction).
- Scroll and load all conversation history.
- Format the content as Markdown.
- Generate and download a JSON file.
The file is named after the current project title by default, for example My_Project.json.
Data Structure
The exported JSON file has a clear structure, convenient for programmatic post-processing or human reading:
{ "system_instruction": "项目的系统提示词", "messages": [ { "role": "user", "content": "用户输入的 Markdown 文本" }, { "role": "assistant", "content": "模型输出的 Markdown 文本" } ]}Notes
While using the script, you may encounter some minor situations:
- Button not showing: Check whether the Tampermonkey extension is enabled, or try refreshing the page.
- Exported content is empty: The script relies on the page’s DOM structure. Make sure the conversation area has loaded properly and can be scrolled.
- Empty System Prompt field: Not all conversations have system prompts set. If the original project has none, this field will naturally be empty.
- Permission prompt: When the script updates, Tampermonkey may request new site permissions — just allow them.
Conclusion
AI Studio Chat Exporter reduces tedious backup work to a single click. This not only saves time, but also makes knowledge management more organized. We hope this small tool brings convenience to everyone’s research and work.