chatgpt.js logo

chatgpt.js

Free

Easy interaction with the ChatGPT DOM.

FreeFree tier
Inputs: textOutputs: text
Type
Open Source
Company
KudoAI

About chatgpt.js

chatgpt.js is an open-source JavaScript library designed to simplify interaction with the ChatGPT web interface's DOM. It provides a powerful, lightweight API for developers to programmatically access and manipulate elements within the ChatGPT page, enabling the creation of custom scripts, browser extensions, and user scripts. The library is available via npm for Node.js projects and as a CDN-hosted script for direct inclusion in web pages or userscripts. It also includes an interactive command-line interface (CLI) that can be used with various API providers, such as OpenRouter and Google AI, to interact with language models outside of the ChatGPT web interface. The project is maintained by KudoAI and is hosted on GitHub, where it has garnered over 2,000 stars and 172 forks.

Key Features

Provides a JavaScript API for interacting with the ChatGPT web interface's DOM
Available as an npm package for Node.js projects
Can be included directly in web pages via a CDN-hosted script
Supports integration with Greasemonkey userscripts and Chrome extensions
Includes a command-line interface (CLI) for interacting with language models via API keys
Supports multiple API providers, including OpenRouter and Google AI
Open-source and free to use
Comprehensive documentation and starter templates available

Pros & Cons

Pros
  • Open-source and free to use
  • Lightweight library with a focus on simplicity
  • Well-documented with starter templates for common use cases
  • Supports multiple integration methods (npm, CDN, userscripts, extensions)
  • Active development and community support on GitHub
Cons
  • Requires familiarity with JavaScript and DOM manipulation
  • Dependent on the ChatGPT web interface structure, which may change
  • CLI requires API keys from supported providers; free tier limits should be verified
  • Not a standalone application; requires existing ChatGPT access or API keys
  • Limited to interactions with ChatGPT and supported API providers

Best For

Automating interactions with the ChatGPT web interfaceBuilding custom browser extensions that enhance ChatGPT functionalityCreating userscripts to modify or extend the ChatGPT experienceDeveloping Node.js applications that programmatically interact with ChatGPTUsing the CLI to query language models from the terminalIntegrating ChatGPT capabilities into other software projects

FAQ

What is chatgpt.js?
chatgpt.js is an open-source JavaScript library that provides an easy way to interact with the ChatGPT DOM. It is designed for developers who want to automate or extend the ChatGPT web interface.
How do I install chatgpt.js?
You can install it via npm with 'npm install @kudoai/chatgpt.js' for Node.js projects, or include it in a web page using a script tag from the CDN. For userscripts and Chrome extensions, specific instructions are provided in the documentation.
Is chatgpt.js free to use?
Yes, chatgpt.js is open-source and free to use. However, using the CLI may require API keys from providers like OpenRouter or Google AI, which may have their own pricing or free tier limits.
Can I use chatgpt.js without a ChatGPT account?
The library is primarily designed to interact with the ChatGPT web interface, so a ChatGPT account is needed for that use case. The CLI can be used with API keys from supported providers, which may not require a ChatGPT account.
Does chatgpt.js work with other AI models?
The CLI supports multiple API providers, including OpenRouter (which offers 300+ models) and Google AI (Gemini and Gemma models). The library itself focuses on the ChatGPT DOM.
Where can I find documentation and examples?
The GitHub repository at https://github.com/kudoai/chatgpt.js includes comprehensive documentation, starter templates for Greasemonkey and Chrome extensions, and a community for support.