ChatGPT Project Overview
The ChatGPT project provides a free reverse proxy API for accessing OpenAI's gpt-3.5-turbo
model. This setup allows users to integrate AI functionalities without modifying their existing code. Although the project is currently outdated and needs updating, users can still benefit from it using hosted models.
Key Features
- Streaming Responses: The API delivers responses as soon as they're ready, ensuring real-time interaction.
- OpenAI Compatibility: It aligns with OpenAI's official API, allowing seamless integration.
- Free Access: No API key is required, making advanced AI accessible to everyone at no cost.
Installation and Self-Hosting
There are multiple methods to set up the API:
Using Docker
- Install Docker by following the Docker Installation Docs.
- Execute the command:
docker run -dp 3040:3040 pawanosman/chatgpt:latest
- Access the local server's API at
http://localhost:3040/v1/chat/completions
.
On Your PC/Server
This method may need a VPN for unsupported countries:
- Install NodeJs (v19+): Download NodeJs.
- Clone the repository:
git clone https://github.com/PawanOsman/ChatGPT.git
- Run
start.bat
(Windows) orbash start.sh
(Linux) to start the server. - Access the API at
http://localhost:3040/v1/chat/completions
.
On Android via Termux
- Install Termux.
- Update and upgrade packages:
apt update && apt upgrade
- Install the necessary tools:
apt install -y git nodejs
- Clone and run the project:
git clone https://github.com/PawanOsman/ChatGPT.git cd ChatGPT bash start.sh
- Access the API at
http://localhost:3040/v1/chat/completions
.
Using Hosted API
Join their Discord server to access the hosted API:
- Obtain an API key from the
#Bot
channel. - Use the key to make requests to
https://api.pawan.krd/v1/chat/completions
.
Usage Examples
Python
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
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
The project is available under the AGPL-3.0 License, providing open access to the underlying code.