A Very Basic OpenAI Reverse Proxy to get your API Service Started + A Discord Bot for Key/Usage Management.
Note: This Will Only Work on Replit as it uses Replit DataBase
This Project on API was done by @SamirXR and @Herumes So give us Proper Credit as we Worked our ASS Off for This!
Join Discord Server for any Assist/Issues or Testing it!
If You like My OpenSource Work you can Support : https://www.buymeacoffee.com/samir.xr
- A Replit Account : Click here
- A Discord Token : Click here
- An OpenAI Key : Click here
Feature | Description |
---|---|
Stream/Non Stream | Supports Streaming/Non-Streaming Response |
Discord Bot | Bot With Key Generation/Regeneration & Usage Information |
Multiple Users | Can Handle Multiple Rqeuests Altogether |
Master Key | A Master Key Only For the Developer |
Credit System | A Credit System that Can be Customized |
OpenAI Library | Supports the Latest OpenAI Library |
- Clone the Repository.
git clone https://github.com/SamirXR/OpenAI-Reverse-Proxy
- Change Directory.
cd OpenAI-Reverse-Proxy
- Make Your Secret Token/APIs on Replit's Secret.
DISCORD_TOKEN
OPEN_AI_KEY
MASTER_KEY
- Install the Requirements
pip install -r requirements.txt
- Then run the API
python main.py
Congratulations! Your API is Up and Running!
Replace the Base_url with your Replit URL and Use Your API Key Generated From Discord Bot/Developer Master Key.
pip install openai==1.7.0
from openai import OpenAI
client = OpenAI(api_key="/generate-key", base_url="Your replit.dev URL Here")
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(completion.choices[0].message.content)