chatgpt.js is a powerful JavaScript library that allows for super easy interaction w/ the ChatGPT DOM.
- Feature-rich
- Object-oriented
- Easy-to-use
- Lightweight (yet optimally performant)
import('https://code.chatgptjs.org/chatgpt-latest.min.js')
.then(module => { yourCode() })
function yourCode() {
// Your code starts here
}
var xhr = new XMLHttpRequest()
xhr.open('GET', 'https://code.chatgptjs.org/chatgpt-latest.min.js')
xhr.onload = function() {
if (xhr.status === 200) {
var chatgptJS = document.createElement('script')
chatgptJS.textContent = xhr.responseText
document.head.appendChild(chatgptJS)
yourCode() // runs your code
}
}
xhr.send()
function yourCode() {
// Your code starts here
}
Userscript repositories like Greasy Fork maintain a whitelist of pre-approved CDNs (such as commit-specific references from cdn.jsdelivr.net
) so the import URL is substantially lengthier to preserve publishability to these sites:
...
// @require https://cdn.jsdelivr.net/gh/chatgptjs/chatgpt.js@b3216af1fad638180237e3624727a146be92cc70/dist/chatgpt-1.5.1.min.js
// ==/UserScript==
// Your code starts here
If you don't plan on publishing to these repos, the simpler https://code.chatgptjs.org/chatgpt-latest.min.js
can be used instead to import the latest minified release.
chatgpt.js was written w/ ultra flexibility in mind.
For example:
chatgpt.getLastResponse()
chatgpt.getLastReply()
chatgpt.get('reply', 'last')
Each call equally fetches the last response. If you think it works, it probabily will... so just type it! (Who has time for docs?)
If it didn't, simply submit an issue or PR and it will be integrated, ezpz!
The following apps rely on code from chatgpt.js:
Auto-clear your ChatGPT query history for maximum privacy.
Install /
Readme /
Discuss
Display ChatGPT answers in Brave Search sidebar.
Install /
Readme /
Discuss
Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks.
Install /
Readme /
Discuss
Generate endless answers from all-knowing ChatGPT (in any language!)
Install /
Readme /
Discuss
Adds Widescreen + Full-Window modes to ChatGPT for reduced scrolling.
Install /
Readme /
Discuss
Display ChatGPT answers in DuckDuckGo sidebar.
Install /
Readme /
Discuss
Whether w/ translations or code, contributions of any kind are encouraged & accepted via PR!