- Notifications
You must be signed in to change notification settings - Fork168
🤖 A powerful, open source client-side JavaScript library for ChatGPT
License
KudoAI/chatgpt.js
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
chatgpt.js is apowerful JavaScript library that allows forsuper easy interaction w/ the ChatGPT DOM.
- Feature-rich
- Object-oriented
- Easy-to-use
- Lightweight (yet optimally performant)
Note
To always import the latest version (not recommended in production!) replace the versioned jsDelivr URL with:https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
(async()=>{awaitimport('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.9.0/dist/chatgpt.min.js');// Your code here...})();
varxhr=newXMLHttpRequest();xhr.open('GET','https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.9.0/dist/chatgpt.min.js');xhr.onload=function(){if(xhr.status===200){varchatgptJS=document.createElement('script');chatgptJS.textContent=xhr.responseText;document.head.append(chatgptJS);yourCode();// runs your code}};xhr.send();functionyourCode(){// Your code here...}
Note
To use a starter template:kudoai/chatgpt.js-greasemonkey-starter
...//@require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.9.0/dist/chatgpt.min.js// ==/UserScript==// Your code here...
Note
To use a starter template:kudoai/chatgpt.js-chrome-starter
Since Google does not allow remote code, importing chatgpt.js locally is required:
Savehttps://raw.githubusercontent.com/KudoAI/chatgpt.js/main/chatgpt.js to a subdirectory (
libin this example)In project's (V3)
manifest.json, addlib/chatgpt.jsas a web accessible resource
"web_accessible_resources": [{"matches": ["<all_urls>"],"resources": ["lib/chatgpt.js"] }],
- In scripts that need
chatgpt.js(foreground/background alike), import it like so:
(async()=>{awaitimport(chrome.runtime.getURL('lib/chatgpt.js'));// Your code here...})();
To downloadchatgpt.js for local customization, run the following command in your project's root:
npm install @kudoai/chatgpt.js
After installation, navigate tonode_modules/@kudoai/chatgpt.js to find the library source.
chatgpt.js was written w/ ultra flexibility in mind.
For example:
chatgpt.getLastResponse();chatgpt.getLastReply();chatgpt.response.getLast();chatgpt.get('reply','last');
Each call equally fetches the last response. If you think it works, it probably will... so just type it!
If it didn't, check out the extendeduserguide, or simply submit anissue orPR and it will be integrated, ezpz!
demo.mp4
Add AI chat & product/category summaries to Amazon shopping, powered by the latest LLMs!
Install /Readme /Discuss
Auto-clear your ChatGPT query history for maximum privacy.
Install /Readme /Discuss
Add AI chat & search summaries to Brave Search, powered by the latest LLMs!
Install /Readme /Discuss
Automatically continue generating answers when ChatGPT responses get cut-off.
Install /Readme /Discuss
Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks.
Install /Readme /Discuss
Add AI chat & search summaries to DuckDuckGo, powered by the latest LLMs!
Install /Readme /Discuss
Add AI chat & search summaries to Google Search, powered by the latest LLMs!
Install /Readme /Discuss
Use ChatGPT in Thunderbird to enhance you emails, even with a free account!
Install /Readme /Support
If you've made something w/ chatgpt.js you want to share, emailshowcase@chatgptjs.org or just open apull request!
This library exists thanks to code, translations, issues & ideas from the following contributors:
About
🤖 A powerful, open source client-side JavaScript library for ChatGPT
Topics
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.










![[Rated 5-stars]](/image.pl?url=https%3a%2f%2fassets.chatgptjs.org%2fimages%2fbadges%2f5-star%2fyellow-stars-in-white-pill.png%3fv%3de638eac&f=jpg&w=240)






