Adds a "Save" button next to "Copy" in ChatGPT code toolbars so you can download code blocks as files. Works both as a Userscript (Tampermonkey/Violentmonkey) and as a Chromium Extension (MV3).
- Userscript:
userscript/chatgpt-save-code.user.js - Extension (Chromium, MV3):
extension/(withmanifest.jsonandcontent.js)
- Install Tampermonkey or Violentmonkey in your browser.
- Import
userscript/chatgpt-save-code.user.jsinto the script manager (or add via raw URL).
- Open
chrome://extensions. - Enable Developer Mode.
- Click "Load unpacked" and select the
extension/folder.
- On
chat.openai.comorchatgpt.com, a "💾 Save" button appears next to "Copy". - Clicking it reads the code from the associated block and downloads it as a file.
- The filename is inferred from the detected language (e.g.,
js,py,Dockerfile) and can be edited in the prompt.
https://chat.openai.com/*https://chatgpt.com/*https://*.openai.com/*
- Language detection uses the code header label and/or classes on the
<code>element (e.g.,language-js). - Dark mode styles are applied automatically via
prefers-color-scheme.
See LICENSE.