Giter Site home page Giter Site logo

caoyunzhou / poe-openai-proxy Goto Github PK

View Code? Open in Web Editor NEW
169.0 6.0 47.0 72 KB

A reverse engineered Python API wrapper for Quora's Poe, which provides free access to ChatGPT, GPT-4, and Claude.

Home Page: https://poe.aivvm.com

License: GNU General Public License v3.0

Dockerfile 0.70% Go 99.30%

poe-openai-proxy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

poe-openai-proxy's Issues

panic recovered

I have not been able to overcome this error. The server has been updated to the latest release. After some time, the server stops working. At the same time, in the terminal I see this:

Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: 2023/07/23 09:23:38 [Recovery] 2023/07/23 - 09:23:38 panic recovered:
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: POST /v1/chat/completions HTTP/1.1
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Host: ltp-snou.com:8000
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Accept: /
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Accept-Encoding: gzip, deflate, br
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Authorization: *
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Connection: keep-alive
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Content-Length: 926
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Content-Type: application/json
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: User-Agent: OpenAI/v1 PythonBindings/0.27.8
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: X-Openai-Client-User-Agent: {"bindings_version": "0.27.8", "httplib": "requests", "lang": "python", "lan>
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]:
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: interface conversion: interface {} is nil, not string
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /snap/go/current/src/runtime/iface.go:262 (0x40c369)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: panicdottypeE: panic(&TypeAssertionError{iface, have, want, ""})
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/poe-openai-proxy/poeapi/utils.go:21 (0x9024cc)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: GetFinalResponse: return m["text"].(string)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/poe-openai-proxy/poe/poe.go:186 (0x902410)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Client).Ask: Content: poeapi.GetFinalResponse(resp),
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/poe-openai-proxy/router/router.go:160 (0x903caa)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Ask: message, err := client.Ask(req.Messages, req.Model)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/poe-openai-proxy/router/router.go:65 (0x9049bc)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: Setup.func2: Ask(c, req, client)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x7c3da1)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Context).Next: c.handlersc.index
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x7c3d8c)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: CustomRecoveryWithWriter.func1: c.Next()
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x7c2ec6)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Context).Next: c.handlersc.index
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 (0x7c2ea9)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: LoggerWithConfig.func1: c.Next()
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x7c1f2a)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Context).Next: c.handlersc.index
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x7c1bb1)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Engine).handleHTTPRequest: c.Next()
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /home/ubuntu/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x7c185c)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*Engine).ServeHTTP: engine.handleHTTPRequest(c)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /snap/go/current/src/net/http/server.go:2936 (0x64e955)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /snap/go/current/src/net/http/server.go:1995 (0x64b271)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: /snap/go/current/src/runtime/asm_amd64.s:1598 (0x468bc0)
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: goexit: BYTE $0x90 // NOP
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]:
Jul 23 09:23:38 ltp-sellow poe-openai-proxy[10244]: [GIN] 2023/07/23 - 09:23:38 | 500 | 1m0s | 101.154.205.230 | POST "/v1/chat/completions"

怎么替换token

怎么替换token
./poe-openai-proxy -e TOKENS="是这样替换吗,可是替换失败了"

不能使用token

不知道是这个项目的问题,还是Python版的问题,还是poe-api的问题

项目推荐

本项目是一个纯poe-api逆向,提供restful接口的,感谢所有贡献者的奉献。

如果你需要使用web的方式,你可能更应该看看下面这些更优秀的仓库配合使用:

poe-api

  • 由于poe.com的网站开发者更新频率很努力,本项目存在不稳定性,且用且珍惜

非常感谢提供思路和借鉴源代码的作者

使用docker部署出现错误

使用docker部署出现错误,这是错误的内容:
ERROR: Recovered in NewClient: %v
runtime error: index out of range [1] with length 0
INFO: Success tokens: []
我使用compose部署,并按照要求填写了3个poe token,但是启动之后在日志中看到了这个

Error: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying

Apparently poe again changed something on the server. When sending a message, the docker exits with an error:

Test
2023/07/27 09:08:27 bot name agouti
2023/07/27 09:08:34 poeapi.go:284: Server returned a status code of 504 while downloading https://poe.com/api/receive_POST. Retrying (1/10)...
2023/07/27 09:08:35 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (2/10)...
2023/07/27 09:08:36 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (3/10)...
2023/07/27 09:08:37 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (4/10)...
2023/07/27 09:08:38 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (5/10)...
2023/07/27 09:08:39 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (6/10)...
2023/07/27 09:08:40 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (7/10)...
2023/07/27 09:08:41 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (8/10)...
2023/07/27 09:08:42 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (9/10)...
2023/07/27 09:08:43 poeapi.go:284: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (10/10)...
panic: failed to download https://poe.com/api/receive_POST too many times

goroutine 392 [running]:
github.com/juzeon/poe-openai-proxy/poeapi.(*Client).sendQuery(0xc00007c380, {0x9fc32e, 0x4}, 0xe?, 0x0?)
/app/poeapi/poeapi.go:629 +0x918
github.com/juzeon/poe-openai-proxy/poeapi.(*Client).sendRecv(0xc00007c380, {0xc0009c3220, 0xf}, {0xa038be, 0x6}, {0xa038be, 0x6}, 0x0?)
/app/poeapi/poeapi.go:847 +0x77
created by github.com/juzeon/poe-openai-proxy/poeapi.(*Client).SendMessage
/app/poeapi/poeapi.go:130 +0xa31

WebSocket connected问题

运行一段时间后,出现这个报错:client error: no available client,只能手动重启才行
报错微信截图_20230726131108

一顿操作猛如虎,结果404了,来自rainway一键安装

部署日志
2023/07/26 12:54:06 load proxy is 2023/07/26 12:54:06 registering client: pPIZUjHuHUCPDgoqoCpclg%3D%3D, proxy 2023/07/26 12:54:06 using proxy 2023/07/26 12:54:06 registering client: 0gS8cz2Iyq0AdfUWOuOGlg%3D%3D, proxy 2023/07/26 12:54:06 using proxy 2023/07/26 12:54:06 new client 0gS8cz2Iyq0AdfUWOuOGlg%3D%3D , proxy <nil> 2023/07/26 12:54:06 new client pPIZUjHuHUCPDgoqoCpclg%3D%3D , proxy <nil> 2023/07/26 12:54:06 registering client: ScZBSvulmX7JliWGTS1Dsw%3D%3D, proxy 2023/07/26 12:54:06 using proxy 2023/07/26 12:54:06 new client ScZBSvulmX7JliWGTS1Dsw%3D%3D , proxy <nil> 2023/07/26 12:54:12 Downloading channel data... 2023/07/26 12:54:12 Downloading channel data... 2023/07/26 12:54:12 Downloading channel data... 2023/07/26 12:54:15 Subscribing to mutations 2023/07/26 12:54:15 Subscribing to mutations 2023/07/26 12:54:15 Subscribing to mutations 2023/07/26 12:54:15 WebSocket connected. 2023/07/26 12:54:16 WebSocket connected. 2023/07/26 12:54:16 WebSocket connected. INFO: Success tokens: [0gS8cz2Iyq0AdfUWOuOGlg%3D%3D pPIZUjHuHUCPDgoqoCpclg%3D%3D ScZBSvulmX7JliWGTS1Dsw%3D%3D] ERROR: Error tokens: [] [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached. [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode) [GIN-debug] GET /models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers) [GIN-debug] GET /v1/models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers) [GIN-debug] POST /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers) [GIN-debug] POST /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers) [GIN-debug] OPTIONS /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers) [GIN-debug] OPTIONS /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers) [GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value. Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details. [GIN-debug] Listening and serving HTTP on :8080 [GIN] 2023/07/26 - 12:54:53 | 404 | 1.137µs | 115.199.123.116 | GET "/" [GIN] 2023/07/26 - 12:54:54 | 404 | 877ns | 115.199.123.116 | GET "/" [GIN] 2023/07/26 - 12:56:10 | 404 | 1.347µs | 115.199.123.116 | GET "/"

panic: failed to download

After the last update, the server is not stable. Sometimes it terminates with this error:
2023/07/21 16:07:48 request url is https://poe.com/api/receive_POST
2023/07/21 16:07:48 request url is https://poe.com/api/receive_POST
2023/07/21 16:07:48 request url is https://poe.com/api/receive_POST
2023/07/21 16:07:48 request url is https://poe.com/api/receive_POST
2023/07/21 16:07:49 request url is https://poe.com/api/receive_POST
2023/07/21 16:07:49 poeapi.go:281: Server returned a status code of 500 while downloading https://poe.com/api/receive_POST. Retrying (1/10)...
2023/07/21 16:07:50 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (2/10)...
2023/07/21 16:07:51 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (3/10)...
2023/07/21 16:07:52 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (4/10)...
2023/07/21 16:07:53 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (5/10)...
2023/07/21 16:07:54 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (6/10)...
2023/07/21 16:07:55 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (7/10)...
2023/07/21 16:07:56 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (8/10)...
2023/07/21 16:07:57 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (9/10)...
2023/07/21 16:07:58 poeapi.go:281: Server returned a status code of 400 while downloading https://poe.com/api/receive_POST. Retrying (10/10)...
panic: failed to download https://poe.com/api/receive_POST too many times

goroutine 1189 [running]:
github.com/juzeon/poe-openai-proxy/poeapi.(*Client).sendQuery(0xc0000000c0, {0xa010ce, 0x4}, 0xe?, 0x0?)
/home/ubuntu/poe-openai-proxy/poeapi/poeapi.go:604 +0x8d8
github.com/juzeon/poe-openai-proxy/poeapi.(*Client).sendRecv(0xc0000000c0, {0xc000a58340, 0xf}, {0xa0b544, 0x8}, {0xa0b544, 0x8}, 0x0?)
/home/ubuntu/poe-openai-proxy/poeapi/poeapi.go:822 +0x77
created by github.com/juzeon/poe-openai-proxy/poeapi.(*Client).SendMessage
/home/ubuntu/poe-openai-proxy/poeapi/poeapi.go:127 +0xa31

请问流式输出的话该如何去写呢?

这样写是错的不能流式输出可否给个例子`url = 'http://127.0.0.1:8080/v1/chat/completions'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-123456'
}
data = {
"model": "chinchilla",
"messages": [{"role": "user", "content": "你好"}]
}

response = requests.post(url, headers=headers, data=json.dumps(data), stream=True)

for line in response.iter_lines():
if line:
json_response = json.loads(line)
print(json_response['choices'][0]['text'])`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.