npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-chatgpt

v1.0.1

Published

A modular automation system for sending messages, receiving responses, and generating images through the ChatGPT web interface using Puppeteer + Stealth.

Readme

🇹🇷 Türkçe Dokümantasyon İçin Tıklayın →

📘 This is the English version of the documentation. For the Turkish version, please refer to the link above.

🧠 web-chatgpt — Advanced Automation System

A fully automated ChatGPT conversation and image generation library using Puppeteer + Stealth. This system works both as a CLI tool and as a reusable module.


🚀 Features

  • 💬 Automatically send messages to ChatGPT and receive ordered responses
  • 🎨 Generate images using DALL·E (.png or base64)
  • 🔁 Retry-supported image generation (queueImage)
  • 🧠 Descriptive fallback for failed generations (describeInstead)
  • ☁️ Stealth support against Cloudflare and bot protections
  • 🍪 Session (cookie) management: login once and reuse
  • ⚙️ Advanced configuration: proxy, language, headless, fingerprint etc.

📦 Installation

git clone https://github.com/Eren-Seyfi/web-chatgpt.git
cd web-chatgpt
npm install

📂 File Structure

web-chatgpt/
├── index.js                → Main entry point
├── login.js                → Login utility to save cookies
├── test.js                 → Test scripts
├── sessions/cookies.json   → Saved session cookies
├── lib/
│   ├── core/               → Bot, queue, page controllers
│   ├── features/           → Chat, image generation features
│   └── utils/              → delay, logger, helpers
└── package.json            → Project configuration

🧪 Commands

| Command | Description | |-------------------|----------------------------------------------------| | npm run login | Opens login page and saves cookies to sessions/ | | npm run test | Executes test.js with sample chat/image logic | | npm start | Runs index.js | | npm run dev | Starts development mode with nodemon |


💬 chat(messages: string[])

const res = await gpt.chat(["Hello!", "Tell me a random joke."]);

Response:

[
  { prompt: "Hello!", content: "Hi there! 👋 How can I help you?" },
  { prompt: "Tell me a random joke.", content: "Why did the..." }
]

🖼️ image(prompt, outputPath)

await gpt.image("a teddy bear made of glowing glass", "bear.png");

🧩 imageBase64(prompt)

const base64 = await gpt.imageBase64("a glowing butterfly at night");
console.log(base64.slice(0, 100) + "...");

Use: <img src="data:image/png;base64,...">


📦 queueImage(items, fallbackDescribeFn?)

await gpt.queueImage([
  {
    prompt: "neon teddy bear",
    output: "bear.png",
    retry: 3,
    retryDelay: 2000,
    backoff: true,
    describeInstead: true
  }
], async (prompt) => {
  await gpt.describe(prompt);
});

🧠 describe(prompt)

await gpt.describe("neon teddy bear");

⚙️ Configuration Options

These can be passed to createChatGPT({...}):

| Option | Type | Description | |------------------|-----------|-------------| | model | string | GPT model to use (gpt-4, gpt-3.5) | | headless | boolean | Whether to hide browser UI (true by default) | | language | string | Browser language (en-US, tr-TR, etc.) | | stealth | boolean | Enables puppeteer-extra stealth plugin | | fingerprint | boolean | Fakes navigator.language, platform, etc. | | proxy.enabled | boolean | Use proxy server | | proxy.server | string | Proxy URL like http://127.0.0.1:8080 | | cookiePath | string | File path to store session cookies (sessions/cookies.json by default) |


🔐 Login & Session Management

The library handles session cookies automatically.

🔓 Without Login (No Cookies)

  • If no cookie file exists or the session is invalid:
    • The browser will open
    • You must manually log in to ChatGPT
    • After login, cookies will be saved to disk
    • On next run, login will be skipped

🔐 With Login (Existing Cookies)

  • If valid cookies exist:
    • Login screen is skipped
    • You are automatically signed in
    • This makes repeated automation faster and seamless

✅ Tip: run npm run login manually once to save a working session before automation.


🧪 Full Integration Example

import { createChatGPT } from "./index.js";

const gpt = await createChatGPT({
  model: "gpt-4",            // GPT model to use
  headless: false,           // Show browser window
  language: "tr-TR",         // Set browser language to Turkish
  stealth: true,             // Enable stealth plugin to avoid bot detection
  fingerprint: true,         // Fake navigator fingerprint
  proxy: {
    enabled: false,          // Disable proxy
    server: ""               // Proxy address if needed
  },
  cookiePath: "sessions/cookies.json" // Path to session cookie file
});

await gpt.chat(["Hello!", "How are you today?"]);

await gpt.image("an owl reading a book under lamp light", "owl.png");

const base64 = await gpt.imageBase64("an ancient city in smoke");
console.log(base64.slice(0, 100));

await gpt.queueImage([
  {
    prompt: "crystal teapot",
    output: "teapot.png",
    retry: 3,
    retryDelay: 2000,
    backoff: true,
    describeInstead: true
  }
], async (prompt) => {
  await gpt.describe(prompt);
});

await gpt.close();

👨‍💻 Author

Eren Seyfi
📫 [email protected]
🌐 GitHub


📜 License

MIT © 2025 Eren Seyfi