chatgptProxyAPI  by x-dr

OpenAI API proxy for network access issues

Created 2 years ago
2,996 stars

Top 15.9% 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

2 months ago

Responsiveness

1 day

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

Explore Similar Projects

Starred by Adam Wolff Adam Wolff(Claude Code Core; MTS at Anthropic), Samuel Colvin Samuel Colvin(Founder and Author of Pydantic), and
5 more.

anthropic-sdk-python by anthropics

0.5%
2k
Python SDK for Anthropic's REST API
Created 2 years ago
Updated 1 day ago
Feedback? Help us improve.