@
root01 ```
server {
listen 88;
location / {
proxy_pass
https://api.openai.com;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
}
}
server {
listen 89;
location / {
proxy_pass
https://api.openai.com$request_uri;
proxy_buffering off;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
}
}
```
89 端口的话我就是关闭了缓冲区输出,如果你想实现流式输出打字机效果的话,就要关闭这个。
请求示例:
```
curl http://代理服务器 IP:88/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Hello!"}]
}'
```