# chatgptProxy **Repository Path**: TianYuanDiKe_admin/chatgptProxy ## Basic Information - **Project Name**: chatgptProxy - **Description**: 灵感来自wechat-chatgpt, 本项目将wechat部分替换为了http接口的形式。最终达到能通过http接口的形式访问chatGpt - **Primary Language**: NodeJS - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2023-02-28 - **Last Updated**: 2023-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## chatGPT proxy 将chatGpt的服务暴露为http接口。 ## 使用 #### 阻塞式接口 本接口会等chatgpt将所有请求处理完后,再进行返回 ``` curl --location 'http://127.0.0.1:8081/v2/message' \ --header 'Content-Type: application/json' \ --data '{ "message": "给黑猫起个名字" }' ``` #### 流式接口 调用代码如下,JavaScript: ``` const source = new EventSource('http://127.0.0.1:8081/v2/stream/example?message=给黑猫起个名字'); source.onopen = () => console.log("Connected"); source.onerror = console.error; source.onmessage = change; ``` 项目提供了测试页面,src/test/index.html