chatgptProxyAPI  by x-dr

OpenAI API proxy for network access issues

created 2 years ago
2,982 stars

Top 16.4% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a free OpenAI API proxy using Cloudflare Workers, designed to circumvent network access issues and support streaming output. It's targeted at developers and users needing reliable access to OpenAI's models, offering a self-hostable solution to bypass geographical restrictions or network blocks.

How It Works

The core mechanism involves deploying a Cloudflare Worker that acts as an intermediary. It routes requests to api.openai.com through a Cloudflare edge location, leveraging the widespread availability and often unblocked nature of Cloudflare's network. Users can then point their applications to this worker's URL, effectively proxying their OpenAI API calls.

Quick Start & Requirements

  • Cloudflare Worker Deployment: Copy cf_worker.js code into a new Cloudflare Worker and bind a domain.
  • Cloudflare Pages Deployment: Use the "Use this template" feature, connect to Git, and deploy via Cloudflare Pages.
  • Docker Deployment: Requires an external VPS.
    docker run -itd --name openaiproxy -p 3000:3000 --restart=always gindex/openaiproxy:latest
    
    API endpoint: http://vpsip:3000/proxy/v1/chat/completions
  • Prerequisites: Cloudflare account, optionally a VPS for Docker deployment.

Highlighted Details

  • Supports streaming output for a more interactive experience.
  • Includes instructions for deploying a proxy with OpenAI API balance querying.
  • Provides example usage with curl, JavaScript fetch, Python requests, and the chatgpt-api Node.js library.
  • Demonstrates how to query OpenAI API subscription status and usage.

Maintenance & Community

No specific contributors, sponsorships, or community links (Discord/Slack) are mentioned in the README.

Licensing & Compatibility

The repository does not explicitly state a license.

Limitations & Caveats

Some IP addresses may encounter access issues, as indicated by a screenshot in the README. The Docker deployment method is noted as potentially not supporting Server-Sent Events (SSE). The provided demo sites may experience high load.

Health Check
Last commit

1 month ago

Responsiveness

1 day

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

Explore Similar Projects

Feedback? Help us improve.