Skip to content

A Very Basic OpenAI Reverse Proxy to get your API Service Started + A Discord Bot for Key Management.

Notifications You must be signed in to change notification settings

SamirXR/OpenAI-Reverse-Proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI-Reverse-Proxy

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

PreRequisites

Features

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

Installation

  1. Clone the Repository.
git clone https://github.com/SamirXR/OpenAI-Reverse-Proxy
  1. Change Directory.
cd OpenAI-Reverse-Proxy
  1. Make Your Secret Token/APIs on Replit's Secret.
 DISCORD_TOKEN
 OPEN_AI_KEY
 MASTER_KEY
  1. Install the Requirements
pip install -r requirements.txt
  1. Then run the API
python main.py

Congratulations! Your API is Up and Running!

Usage

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)

About

A Very Basic OpenAI Reverse Proxy to get your API Service Started + A Discord Bot for Key Management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages