Skip to content

a proxy for forwarding openAI requests 一个用来转发OpenAI请求的玩意

License

Notifications You must be signed in to change notification settings

Zuckonit/chatgpt-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文 README

a proxy for forwarding OpenAI chat completion requests

Usage

  1. set a custom auth secret in proxy.py

    Edit the auth_secret variable in proxy.py to a custom secret string.

  2. install requirements

pip install -r requirements.txt
  1. run the server

Note: Your server has to be in the region which has access to OpenAI APIs.

python proxy.py

or run with gunicon

pip install gunicorn
gunicorn -w 4 -b "0.0.0.0:5000" proxy:app --log-level=debug
  1. send requests
import requests

data = {
    # don't forget this auth in your request body
    "auth": "<your-custom-auth-secret>",
    "model": "gpt-3.5-turbo",
    "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Introducing Marushiru Donato."}
    ],
    "temperature": 0.6,
    "stream": True
}
headers = {"Authorization": "Bearer <your-openai-token>"}
resp = requests.post("http://<your-server-ip>:5000/v1/chat/completions", headers=headers, json=data)

About

a proxy for forwarding openAI requests 一个用来转发OpenAI请求的玩意

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%