updates README

This commit is contained in:
nai-degen 2023-04-09 21:14:22 -05:00 committed by nai-degen
parent 518a5b125d
commit 377194cad8
2 changed files with 20 additions and 8 deletions

View File

@ -7,24 +7,36 @@ sdk: docker
pinned: false
---
<!-- -->
# OAI Reverse Proxy Server
# OAI Reverse Proxy
Simple reverse proxy server for the OpenAI API.
Reverse proxy server for the OpenAI API. Forwards text generation requests while rejecting administrative/billing requests. Includes optional rate limiting and prompt filtering to prevent abuse.
### Table of Contents
- [What is this?](#what-is-this)
- [Why?](#why)
- [Setup Instructions](#setup-instructions)
- [Deploy to Huggingface (Recommended)](#deploy-to-huggingface-recommended)
- [Deploy to Repl.it (WIP)](#deploy-to-replit-wip)
## What is this?
If you have an API key you want to share with a friend, you can use this to keep your key safe while still allowing them to generate text with the API.
You can also use this if you'd like to build a client-side application which uses the OpenAI, but don't want to build your own backend. You should never embed your real OpenAI API key in a client-side application. Instead, you can have your frontend connect to this reverse proxy and forward requests to OpenAI.
This keeps your keys safe and allows you to use the rate limiting and prompt filtering features of the proxy to prevent abuse.
## Why?
OpenAI keys have full account permissions. They can revoke themselves, generate new keys, modify spend quotas, etc. You absolutely should not share them.
OpenAI keys have full account permissions. They can revoke themselves, generate new keys, modify spend quotas, etc. You absolutely should not share them, nor should you embed them in client-side applications as they can be easily stolen.
If you still want to share access to your key, you can put it behind this proxy to ensure it can't be used to do anything but generate text. You can also set a separate key on the proxy to gatekeep access.
This proxy only forwards text generation requests to OpenAI and rejects requests which would otherwise modify your account.
## How to use
---
## Setup Instructions
Since this is a server, you'll need to deploy it somewhere. A few options are available:
### Deploy to Huggingface (Recommended)
[See here for instructions on deploying to a Huggingface Space.](./docs/huggingface.md)
[See here for instructions on how to deploy to a Huggingface Space.](./docs/huggingface.md)
### Deploy to Repl.it (WIP)
Still working on this. It's a bit more technical than the Huggingface option; you can give it a shot by clicking on the button below.

View File

@ -14,7 +14,7 @@ This repository can be deployed to a [Huggingface Space](https://huggingface.co/
![Create Space](huggingface-createspace.png)
### 3. Create an empty Dockerfile
- Once your space is created, you'll see an option to "Create the Dockerfile in your browser". Click that link.
- Once your Space is created, you'll see an option to "Create the Dockerfile in your browser". Click that link.
![Create Dockerfile](huggingface-dockerfile.png)
- Paste the following into the text editor and click "Save".
@ -58,7 +58,7 @@ You can just restart your server to have it pull the latest version of the code
## Customizing the server
The server will be started with some default configuration, but you can override it by adding a `.env` file to your space. You can use Huggingface's web editor to create a new `.env` file alongside your Dockerfile. Huggingface will restart your server automatically when you save the file.
The server will be started with some default configuration, but you can override it by adding a `.env` file to your Space. You can use Huggingface's web editor to create a new `.env` file alongside your Dockerfile. Huggingface will restart your server automatically when you save the file.
Here are some example settings:
```shell