How to Set Up the ChatGPT API Free Reverse Proxy

Aug 15, 2021 | Educational

Welcome to the guide on how to set up the ChatGPT API Free Reverse Proxy, offering a seamless way to access the power of OpenAI’s gpt-3.5-turbo without the need for an API key. Although the project is a bit outdated at the moment, we’re here to walk you through the self-hosting process and provide you with alternative methods to access the API.

Quick Links

Table of Contents

Features

  • Streaming Response: The API supports streaming response, so you can get the response as soon as it’s available.
  • API Endpoint Compatibility: Full alignment with official OpenAI API endpoints, ensuring hassle-free integration with existing OpenAI libraries.
  • Complimentary Access: No charges for API usage, making advanced AI accessible to everyone, even without an API key.

Installing Self-Hosting Guide

Using Docker

If you prefer using Docker, follow these steps:

  1. Ensure Docker is installed by referring to the Docker Installation Docs.
  2. Run the following command:
  3. docker run -dp 3040:3040 pawanosmanchatgpt:latest
  4. Done! You can now connect to your local server’s API at: http://localhost:3040/v1/chat/completions.

Install with Chat Web Interfaces

You can run third-party chat web interfaces, such as BetterChatGPT and LobeChat, using this API with Docker Compose. Click here for the installation guide.

Your PC/Server

To install and run the ChatGPT API Reverse Proxy on your PC/Server, follow these steps:

  1. Ensure Node.js (v19+) is installed: Download Node.js.
  2. Clone this repository:
  3. git clone https://github.com/PawanOsman/ChatGPT.git
  4. Open start.bat (Windows) or start.sh (Linux) to install dependencies and launch the server.
  5. Done! You can connect to your local server’s API at: http://localhost:3040/v1/chat/completions.

Termux on Android Phones

To run the ChatGPT API Reverse Proxy on Android using Termux, follow these steps:

  1. Install Termux from the Play Store.
  2. Update Termux packages:
  3. apt update
  4. Upgrade Termux packages:
  5. apt upgrade
  6. Install git, Node.js, and npm:
  7. apt install -y git nodejs
  8. Clone the repository:
  9. git clone https://github.com/PawanOsman/ChatGPT.git
  10. Navigate to the cloned directory:
  11. cd ChatGPT
  12. Start the server with:
  13. bash start.sh
  14. Your local server will now be running and accessible at: http://localhost:3040/v1/chat/completions.

Accessing Our Hosted API

Utilize our pre-hosted ChatGPT-like API for free by:

  1. Joining our Discord server.
  2. Obtaining an API key from the #Bot channel with the key command.
  3. Incorporating the API key into your requests to: https://api.pawan.krd/v1/chat/completions.

Usage Examples

Leverage the same integration code as OpenAI’s official libraries by simply adjusting the API key and base URL in your requests. For self-hosted setups, ensure to switch the base URL to your local server’s address as mentioned above.

Example Usage with OpenAI Libraries

Python Example

import openai
openai.api_key = 'anything'
openai.base_url = 'http://localhost:3040/v1'
completion = openai.chat.completions.create(
    model='gpt-3.5-turbo',
    messages=[
        {'role': 'user', 'content': 'How do I list all files in a directory using Python?'},
    ],
)
print(completion.choices[0].message.content)

Node.js Example

import OpenAI from 'openai';

const openai = new OpenAI({
    apiKey: 'anything',
    baseURL: 'http://localhost:3040/v1',
});

const chatCompletion = await openai.chat.completions.create({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'gpt-3.5-turbo',
});
console.log(chatCompletion.choices[0].message.content);

License

This project is under the AGPL-3.0 License. Refer to the LICENSE file for detailed information.

Troubleshooting

If you encounter any issues while setting up, consider the following troubleshooting steps:

  • Ensure your Docker is running properly if using Docker.
  • Check Node.js installation if you’re using a PC/server setup.
  • Verify that the right URL and endpoint are being accessed.
  • Remember to join our Discord community for real-time help.
  • For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

With just a few steps, you can harness the impressive capabilities of the ChatGPT API Free Reverse Proxy. Don’t hesitate to explore other options if you face any blockage while setting things up. Such advancements are crucial for the future of AI, enabling more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox