chatgpt-api-by-browser-script  by zsodur

Browser-based API for ChatGPT web interface

Created 2 years ago
250 stars

Top 100.0% on SourcePulse

GitHubView on GitHub
Project Summary

<2-3 sentences summarising what the project addresses and solves, the target audience, and the benefit.> This project offers a local API interface for the ChatGPT web version, accessible via a Tampermonkey script. It enables developers and power users to integrate GPT-4 and other models into applications like Auto-GPT by exposing ChatGPT's web functionality as a local HTTP endpoint. The primary benefit is programmatic access to ChatGPT without official API fees, alongside features like unlimited context and reduced risk of account bans.

How It Works

<2-4 sentences on core approach / design (key algorithms, models, data flow, or architectural choices) and why this approach is advantageous or novel.> The core mechanism involves a Node.js server running locally, which acts as a proxy. A Tampermonkey script injected into the ChatGPT web page intercepts user interactions and translates them into API requests directed at this local server. This server then communicates with the ChatGPT web UI, processes the responses, and returns them in a format compatible with the OpenAI API. A separate browser extension is also required, necessitating the disabling of the browser's Content-Security-Policy.

Quick Start & Requirements

  • Installation: Clone the repository, navigate to the project directory, and run npm install followed by npm run start. Alternatively, use docker-compose up.
  • Prerequisites: Node.js and npm installed. Tampermonkey browser extension. A separate browser extension (download link not explicitly provided).
  • Configuration: Install Tampermonkey, create a new script by copying the contents of tampermonkey-script.js, and save it. Disable Content-Security-Policy in your browser. Log in to https://chat.openai.com/.
  • API Endpoint: http://localhost:8766/v1/chat/completions.

Highlighted Details

  • Provides "API no cost" access, though GPT-4 requires a ChatGPT Plus subscription.
  • Offers unlimited context window capabilities.
  • Designed to be less prone to account bans and easier to manage errors compared to direct web scraping.
  • Supports the latest ChatGPT UI versions and GPT-4o (as of May 2024).
  • Exposes a local API endpoint mimicking OpenAI's chat completions interface.

Maintenance & Community

No specific details regarding maintainers, community channels (e.g., Discord, Slack), sponsorships, or a public roadmap are provided in the README.

Licensing & Compatibility

The README does not specify a software license. This lack of clarity may pose compatibility issues for commercial use or integration into closed-source projects.

Limitations & Caveats

Functionality is dependent on the stability of OpenAI's ChatGPT web interface; UI changes could break the script. Disabling Content-Security-Policy introduces potential security risks. The exact download source for the required separate browser extension is not explicitly detailed in the provided text. No license information is available.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
4 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.