https://github.com/connectai-e/chatgpt-severless-proxy
利用阿里云函数给openai搭建反向代理,🤹🏻♂️支持负载均衡和自定义token
https://github.com/connectai-e/chatgpt-severless-proxy
Last synced: 8 months ago
JSON representation
利用阿里云函数给openai搭建反向代理,🤹🏻♂️支持负载均衡和自定义token
- Host: GitHub
- URL: https://github.com/connectai-e/chatgpt-severless-proxy
- Owner: ConnectAI-E
- License: mit
- Created: 2023-03-30T09:37:45.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T14:14:29.000Z (about 3 years ago)
- Last Synced: 2025-02-17T03:12:28.069Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ChatGPT-Severless-Proxy


A reverse proxy of https://api.openai.com that supports token load-balance and avoids token leakage
openai api reference
`https://platform.openai.com/docs/api-reference`
## Feature
- simple, clean but efficent code
- providing an authorization without openai token leakage
- supproting token load-balance
- avoiding the limitation of single openai token
- removing invalid token automatically
## 本地开发
```nashorn js
cd code
mv config.example.yaml config.yaml
```
```
OPENAI_KEY: sk-xxx,sk-xx
AUTH_TOKEN: xxxxxxx
PORT: 9000
TARGET: https://api.openai.com
```
```
go run main.go
```
## 部署上线
```
cd ..
s deploy
```
Use by cURL
```
curl --location 'http://localhost:8080/v1/chat/completions' \
--header 'Authorization: Bearer YOUR_AUTHORIZATION' \
--header 'Content-Type: application/json' \
--data '{
"max_tokens": 250,
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'
```