Skip to content
프로젝트

소개

한 줄의 Docker 명령으로 배포할 수 있는 OpenAI/GPT API 프록시입니다. SSE 스트리밍 응답과 Tencent Cloud Functions를 지원합니다. 한 줄의 Docker 명령으로 실행하는 간단한 OpenAI API 프록시입니다.

시스템 및 인프라

이 수치를 측정하는 방법

What you can do

  • Supports SSE streaming output
  • Built-in text moderation (requires Tencent Cloud KEY configuration)
  • 💪 SSE streaming output supports text moderation, that's how powerful it is.

측정된 스타 증가

in 24h
0
in 7 days
-1
in 15 days
-4
in 1 month
-5

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

openai-api-proxy

可以部署到docker和云函数的OpenAI API代理 Simple proxy for OpenAi api via a one-line docker command

🌳 如果你懒得自己搭建,那么可以试试国内可以访问、可以微信充值的第三方OpenAI API服务:API2D.com,支持Chat酱、OpenCat、NextWeb、VSCode插件。

🎉 已经支持SSE,可以实时返回内容

以下英文由GPT翻译。The following English was translated by GPT.

⚠️ This is the server-side of the proxy, not the client-side. It needs to be deployed to a network environment that can access the openai api.

Features

  1. Supports SSE streaming output
  2. Built-in text moderation (requires Tencent Cloud KEY configuration)
  3. 💪 SSE streaming output supports text moderation, that's how powerful it is.

NodeJS Deployment

You can deploy ./app.js to any environment that supports nodejs 14+, such as cloud functions and edge computing platforms.

  1. Copy app.js and package.json to the directory
  2. Install dependencies with yarn install
  3. Start the service with node app.js

Docker Deployment

docker run -p 9000:9000 easychen/ai.level06.com:latest

The proxy address is http://${IP}:9000

Available Environment Variables

  1. PORT: Service port
  2. PROXY_KEY: Proxy access key, used to restrict access
  3. TIMEOUT: Request timeout, default 30 seconds
  4. TENCENT_CLOUD_SID: Tencent Cloud secret_id
  5. TENCENT_CLOUD_SKEY: Tencent Cloud secret_key
  6. TENCENT_CLOUD_AP: Tencent Cloud region (e.g. ap-singapore Singapore)

API Usage

  1. Change the domain/IP (with port number) of the openai request address in the original project (e.g. https://api.openai.com) to the domain/IP of this proxy.
  2. If PROXY_KEY is set, add :<PROXY_KEY> after the openai key. If not set, no modification is required.
  3. moderation: true enables moderation, false disables moderation
  4. moderation_level: high interrupts all sentences whose moderation result is not Pass, low only interrupts sentences whose moderation result is Block.

Notes

  1. Only supports GET and POST methods, not file-related interfaces.
  2. SSE is not currently supported, so stream-related options need to be turned off Now supported.

Client-side Usage Example

Using https://www.npmjs.com/package/chatgpt as an example:

chatApi= new gpt.ChatGPTAPI({
    apiKey: 'sk.....:<proxy_key_here>',
    apiBaseUrl: "http://localhost:9001/v1", // Replace with proxy domain/IP
});
   

Acknowledgements

  1. SSE reference to chatgpt-api project related code

관련 프로젝트 살펴보기

불러오는 중…