chat2api  by lanqian528

API proxy for converting web ChatGPT to OpenAI API format

created 1 year ago
3,084 stars

Top 15.9% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a service to convert ChatGPT web access into an OpenAI-compatible API format, targeting developers and users who need to integrate ChatGPT capabilities into their applications without direct API keys. It offers free access to GPT-3.5 and supports various paid models like GPT-4, GPT-4o, and GPTs, mimicking the official API response structure for broad client compatibility.

How It Works

The core of the project is a reverse-engineered API that intercepts and processes requests to ChatGPT's web interface. It supports both streaming and non-streaming responses, and can handle various models by parsing the model parameter in requests. For paid models, it utilizes AccessToken or RefreshToken for authentication, with features for managing multiple accounts, token refreshing, and load balancing.

Quick Start & Requirements

  • Install: pip install -r requirements.txt then python app.py
  • Prerequisites: Python 3.x. Optional: Docker, Docker Compose.
  • Setup: Basic setup is quick, but obtaining AccessToken/RefreshToken and configuring proxies or environment variables may add time.
  • Docs: https://github.com/LanQian528/chat2api

Highlighted Details

  • Supports GPT-3.5 (free, no login), GPT-4 series, O1 series, and GPTs.
  • Mimics OpenAI API response format for seamless integration.
  • Includes gateway mode for distributed deployment and multi-account polling.
  • Supports file uploads and downloads.

Maintenance & Community

Licensing & Compatibility

  • MIT License. Permissive for commercial use and closed-source linking.

Limitations & Caveats

The project relies on reverse-engineering ChatGPT's web interface, making it susceptible to changes by OpenAI that could break functionality. Some IPs may not support the free GPT-3.5 access, and certain models might have regional availability or IP-based restrictions.

Health Check
Last commit

2 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
2
Star History
220 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.