Home

Awesome

<div id="repo-cover" align="center"> <div align="center"> <h6> <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs"> <picture> <source type="image/svg+xml" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/icons/earth-americas-white-padded-icon17x15.svg?714b6a1"> <img src="https://media.chatgptjs.org/images/icons/earth-americas-padded-icon17x15.svg?714b6a1"> </picture> </a> English | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/zh-cn#readme">简体中文</a> | <a href="zh-tw#readme">繁體中文</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/ja#readme">日本</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/ko#readme">한국인</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/hi#readme">हिंदी</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/np#readme">नेपाली</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/de#readme">Deutsch</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/es#readme">Español</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/fr#readme">Français</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/it#readme">Italiano</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/nl#readme">Nederlands</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/pt#readme">Português</a> | <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs/vi#readme">Việt</a> </h6> </div> <br> <a href="https://chatgpt.js.org"> <picture> <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/chatgpt.js/with-reflection/darkmode.png?bc68d0c"> <img width=800 src="https://media.chatgptjs.org/images/logos/chatgpt.js/with-reflection/lightmode.png?bc68d0c"> </picture> </a>

🤖 A powerful client-side JavaScript library for ChatGPT

</div> <br> <div id="shields" align="center">

</div> <img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="intro">

💡 About

</div>

<span style="color: white"><b>chatgpt.js</b></span> is a <span style="color: white">powerful</span> JavaScript library that allows for <span style="color: white">super easy</span> interaction w/ the ChatGPT DOM.

<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="importing">

⚡ Importing the library

</div>

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

ES11 (2020):

(async () => {
    await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
    // Your code here...
})();

ES5 (2009):

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
xhr.onload = function () {
    if (xhr.status === 200) {
        var chatgptJS = document.createElement('script');
        chatgptJS.textContent = xhr.responseText;
        document.head.append(chatgptJS);
        yourCode(); // runs your code
    }
};
xhr.send();

function yourCode() {
    // Your code here...
}

<img style="margin: 0 2px -0.065rem 0" height=17 src="https://media.chatgptjs.org/images/icons/platforms/tampermonkey/icon28.png?a3e53bf7"><img style="margin: 0 2px -0.035rem 1px" height=17.5 src="https://media.chatgptjs.org/images/icons/platforms/violentmonkey/icon25.png?a3e53bf7"> Greasemonkey:

Note To use a starter template: kudoai/chatgpt.js-greasemonkey-starter

...
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js
// ==/UserScript==

// Your code here...

<img style="margin: 0 2px -1px 0" height=16 src="https://media.chatgptjs.org/images/icons/platforms/chrome/icon16.png?8c852fa5"> Chrome:

Note To use a starter template: kudoai/chatgpt.js-chrome-starter

Since Google does not allow remote code, importing chatgpt.js locally is required:

  1. Save https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/chatgpt.js to a subdirectory (lib in this example)

  2. In project's (V3) manifest.json, add lib/chatgpt.js as a web accessible resource

    "web_accessible_resources": [{
        "matches": ["<all_urls>"],
        "resources": ["lib/chatgpt.js"]
    }],
  1. In scripts that need chatgpt.js (foreground/background alike), import it like so:
(async () => {
    await import(chrome.runtime.getURL('lib/chatgpt.js'));
    // Your code here...
})();
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="npm">

💾 Downloading via npm:

</div>

To download chatgpt.js for local customization, run the following command in your project's root:

npm install @kudoai/chatgpt.js

After installation, navigate to node_modules/@kudoai/chatgpt.js to find the library source.

</div> <img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="usage">

💻 Usage

</div>

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 extended userguide, or simply submit an issue or PR and it will be integrated, ezpz!

<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="showcase">

🤖 Made with chatgpt.js

</div>

https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3140b0f8a4

<img src="https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png" width=20> AmazonGPT  <a href="https://devpost.com/software/amazongpt" target="_blank" rel="noopener"><img height=20 src="https://amazongpt.kudoai.com/assets/images/badges/wolfram-award/gold-badge.png" style="margin:0 0 -2px 5px"></a>

Add AI to Amazon shopping. <br>Install / Readme / Discuss

<picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.autoclearchatgpt.com/images/icons/openai/white/icon48.png?cece513"><img width=21 src="https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?cece513"></picture> Autoclear ChatGPT History  <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.autoclearchatgpt.com/images/badges/awesome/badge.svg?2c0d9fc" style="margin:0 0 -2px 5px"></a>

Auto-clear your ChatGPT query history for maximum privacy. <br>Install / Readme / Discuss

<img width=24 src="https://media.bravegpt.com/images/icons/bravegpt/icon48.png?0a9e287"> BraveGPT  <a href="https://www.producthunt.com/posts/bravegpt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-bravegpt" target="_blank" rel="noopener"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=385630&theme=light" style="width: 112px; height: 24px; margin:0 0 -4px 5px;" width="112" height="24" /></a>

Adds AI answers to Brave Search (powered by GPT-4o!) <br>Install / Readme / Discuss

<picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptautocontinue.com/images/icons/openai/white/icon48.png?7bbd222"><img width=21 src="https://media.chatgptautocontinue.com/images/icons/openai/black/icon48.png?7bbd222"></picture> ChatGPT Auto-Continue ⏩  <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.chatgptautocontinue.com/images/badges/awesome/badge.svg?3c80c0c" style="margin:0 0 -3px 3px"></a>

Automatically continue generating multiple ChatGPT responses. <br>Install / Readme / Discuss

<picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@eb7f285/assets/images/icons/openai/white/icon64.png"><img width=21 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@eb7f285/assets/images/icons/openai/black/icon64.png"></picture> ChatGPT Auto-Talk 📣

Auto-play ChatGPT responses. <br>Install / Readme / Discuss

<picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptautorefresh.com/images/icons/openai/white/icon48.png?a45cf1e"><img width=21 src="https://media.chatgptautorefresh.com/images/icons/openai/black/icon48.png?a45cf1e"></picture> ChatGPT Auto Refresh ↻  <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.chatgptautorefresh.com/images/badges/awesome/badge.svg?1080f44" style="margin:0 0 -2px 5px"></a>

Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks. <br>Install / Readme / Discuss

<img width=23 src="https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302"> DuckDuckGPT  <a href="https://www.producthunt.com/posts/duckduckgpt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-duckduckgpt" target="_blank" rel="noopener"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=379261&theme=light" style="width: 112px; height: 24px; margin:0 0 -4px 5px;" width="112" height="24" /></a>

Adds AI answers to DuckDuckGo (powered by GPT-4o!) <br>Install / Readme / Discuss

<picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.googlegpt.io/images/icons/googlegpt/white/icon32.png?8652a6e"><img width=21 src="https://media.googlegpt.io/images/icons/googlegpt/black/icon32.png?8652a6e"></picture> GoogleGPT  <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.googlegpt.io/images/badges/awesome/badge.svg?699c63d" style="margin:0 0 -2px 5px"></a>

Adds AI answers to Google Search (powered by Google Gemma + GPT-4o!) <br>Install / Readme / Discuss

<img width=23 src="https://media.chatgptjs.org/images/icons/platforms/thunderbird/icon32.png?313a9c5"> ThunderAI  <a href="https://addons.thunderbird.net/thunderbird/addon/thunderai/reviews" target="_blank" rel="noopener"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/badges/5-star/blue-stars.png?0943672"><img width=92 alt="[Rated 5-stars]" src="https://media.chatgptjs.org/images/badges/5-star/yellow-stars-in-white-pill.png?0943672"></picture></a>

Use ChatGPT in Thunderbird to enhance you emails, even with a free account! <br>Install / Readme / Support

<p><br> <a href="https://chatgptinfinity.com" target="_blank" rel="noopener"> <img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-infinity@0f48c4e/chrome/media/images/tiles/marquee-promo-tile-1400x560.png"> </a> <p><br> <a href="https://chatgptwidescreen.com" target="_blank" rel="noopener"> <img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@3ed0950/chrome/media/images/tiles/marquee-promo-tile-1400x560.png"> </a> <p><br> <p id="showcase-cta"> If you've made something w/ chatgpt.js you want to share, email <a href="mailto:showcase@chatgptjs.org">showcase@chatgptjs.org</a> or just open a <a href="https://github.com/KudoAI/chatgpt.js/pulls" target="_blank" rel="noopener">pull request</a>! </p> <img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="contributors">

🧠 Contributors

</div>

This library exists thanks to code, translations, issues & ideas from the following contributors:

<div align="center"><br>

<a href="https://chatgpt.com"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/chatgpt/black-on-white/icon189.png?h=46&w=46&mask=circle&maxage=7d"><img src="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/chatgpt/white-on-black/icon189.png?h=46&w=46&mask=circle&maxage=7d" title="ChatGPT"></picture></a> <a href="https://poe.com"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/poe/w-purple-blue-stripes/black-on-white/icon175.png?h=46&w=46&mask=circle&maxage=7d"><img src="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/poe/w-purple-blue-stripes/white-on-black/icon175.png?h=46&w=46&mask=circle&maxage=7d" title="Poe"></picture></a>

</div><br> <img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div id="partners">

🤝 Partners

</div>

chatgpt.js is funded in part by:

<div id="partners-collage" align="center"> <picture> <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/partners/collage/white.png?3109608"> <img width=888 src="https://media.chatgptjs.org/images/logos/partners/collage/black.png?3109608"> </picture> </div> <br> <img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7"> <div align="center">

Releases / Userguide / Discuss / <a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>

</div>