Status: [LIVE] Endpoints found: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/chatgpt https://learn.microsoft.com/zh-cn/azure/ai-services/openai/chatgpt-quickstart?tabs=command-line%2Cpython&pivots=programming-language-go Source: https://github.com/lenye/chatgpt_reverse_proxy # ai api reverse proxy ChatGPT_reverse_proxy 是 ai api 反向代理。可以在自建服务器、云函数上使用。 * 默认支持 OpenAI API 反向代理,请求 api 时,直接把接口地址 ( https://api.openai.com ) 替换为反向代理服务的地址。 * 支持 Azure OpenAI API 反向代理,将 OXY_TARGET 环境变量修改为 Azure OpenAI 服务地址示例:https://docs-test-001.openai.azure.com ```markdown Azure 检索密钥和服务地址 https://learn.microsoft.com/zh-cn/azure/ai-services/openai/chatgpt-quickstart?tabs=command-line%2Cpython&pivots=programming-language-go ``` ## 可用的环境变量 1. OXY_TARGET: 反向代理目标,默认=https://api.openai.com 2. OXY_PORT: 代理服务端口,默认=9000 3. OXY_HOP_HEADER_PREFIX: 跳过 http header 前缀,默认为空 ## 自托管 ai api 反向代理服务 ### 使用二进制发行版 1. 支持的操作系统 * Windows * Linux * macOS * FreeBSD 1. 下载 `chatgpt_reverse_proxy` [最新版本 releases](https://github.com/lenye/chatgpt_reverse_proxy/releases) 1. 开始运行它: linux 如需重新定义环境变量 ```shell $ export OXY_PORT=9000 ``` 运行反向代理服务 ```shell $ ./chatgpt_reverse_proxy ``` 1. OpenAI API 端点地址样例: ``` http://localhost:9000/v1/completions http://localhost:9000/v1/chat/completions ``` ### 在云函数搭建 ai api 反向代理服务
腾讯云函数 使用腾讯云函数来搭建 ai api 反向代理服务。 #### 预设的环境变量 1. OXY_PORT: 9000 (代理服务端口) 2. OXY_HOP_HEADER_PREFIX: X-SCF (跳过 http header 前缀) #### ZIP包下载 * 下载地址: https://github.com/lenye/chatgpt_reverse_proxy/releases * 文件名: tencentcloud_scf_chatgpt_reverse_proxy_v0.x.x_linux_amd64.zip #### a. 新建云函数 1. 进入腾讯云函数控制台: https://console.cloud.tencent.com/scf/list?rid=15&ns=d