Starlet #4 chatgpt.js - Client-side JavaScript library for ChatGPT
LogoBlogAdd Access Token

Starlet #4 chatgpt.js - Client-side JavaScript library for ChatGPT

Adam Lui 3 min read

This is the fourth issue of The Starlet List. If you want to prompt your open source project on star-history.com for free, please check out our announcement.


chatgpt.js landing page

Back in 2022, OpenAI had been releasing large language models to the public since 2020's GPT-3 (triggering Microsoft's eventual investment for a whopping 49% stake in the company).

Even before that, OpenAI had been releasing versions of GPT privately for nearly five years.

It was not until the launch of ChatGPT (powered by GPT-3.5) on November 20, 2022, did AI finally capture the mainstream imagination of humankind — becoming the fastest-growing app in the history of the universe (outpacing even TikTok/Douyin!)

Unsurprisingly, an ecosystem of tools that either utilize or enhance the AI's astounding power has blossomed.

chatgpt.js is a JavaScript library that emerged in the following months, supporting this ecosystem by allowing for super-easy interaction w/ the ChatGPT DOM.

Importing the library

;(async () => {
    await import("https://code.chatgptjs.org/chatgpt-latest.min.js")
    // Your code here...
})()

Usage

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 (from either DOM or API, dependent on script environment.)

Chrome extension made with chatgpt.js

If you think it works, it probabily will... so just type it! If it didn't, an extended userguide is available for guidance.

Made with chatgpt.js

Some popular & award-winning apps made w/ chatgpt.js include:

  • Autoclear ChatGPT History - Featured by Futurepedia - Auto-clears your ChatGPT query history for maximum privacy
  • Automatic ChatGPT DAN - Automatically send DAN prompts to ChatGPT
  • BraveGPT - Featured by Product Hunt - Display ChatGPT answers in Brave Search sidebar (powered by GPT-4!)
  • ChatGPT Auto-Continue - Mentioned in Awesome - Automatically continue generating multiple ChatGPT responses
  • ChatGPT Auto Refresh - Featured by Futurepedia - Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks
  • ChatGPT Infinity - Featured by Google - Generate endless answers from all-knowing ChatGPT (in any language!)
  • ChatGPT Widescreen - Awarded #2 Product of the Week (in UX) by Product Hunt - Adds Widescreen/Full-Window/Fullscreen toggles/modes to ChatGPT + Poe
  • DuckDuckGPT - Featured by Product Hunt - Display ChatGPT answers in DuckDuckGo sidebar (powered by GPT-4!)

Star growth

chatgpt.js is still a very young lib, but as shown by the Star History chart, it had a stunning growth period during a span of mere weeks:

Star History Chart

Two main events can be attributed with causing this astonishing growth spurt:

  • In June 2023, editors at Product Hunt featured chatgpt.js on its front page, resulting in 100+ upvotes & thousands of unique visitors in the following days

GitHub growth spike after Product Hunt launch

  • Within that same week, TLDR — a tech & programming newsletter w/ over 1,000,000 readers — featured the repo near the bottom of e-mail (where readers commonly anchor to)

image

Future development

chatgpt.js is continuously maintained, with new features added based on user demand in the GitHub repo.

The project is open to sponsorships: if you are a company or individual and believe in the project, you can consider pioneering chatgpt.js growth!

8/14 Update — chatgpt.js is now part of 100 Builders, an AI incubator funded by industry heavyweights like Stability.ai (creators of Stable Diffusion) & Coinbase Ventures!