Skip to content

将chatgpt前端进行逆向,实现绕过cloudflare 对官方api进行代理 实现前端接口转标准api(通过access_token实现标准api传入访问)

License

Notifications You must be signed in to change notification settings

brucelau1987cn/WarpGPT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warp-GPT

作为刚学go的一个练手项目,自用

  • 将chatgpt前端进行逆向,实现绕过cloudflare
  • 对官方api进行代理
  • 实现前端接口转标准api(通过access_token实现标准api传入访问)

端口列表

/backend-api/* (前端逆向接口)
/backend-api/conversation/ws (前端WS逆向为原数据流格式)
/api/* (前端逆向接口)
/public-api/* (前端逆向接口)
/v1/* (官方api代理)
/r/v1/chat/completions (前端接口转标准api,支持流式)
/r/v1/chat/completions/ws (前端WS转标准api,支持流式)
/r/ws/v1/chat/completions (功能相同,提供兼容)
/r/v1/images/generations (前端接口转标准api,不支持流式,只支持gpt-4的账户)
/getsession (实现__Secure-next-auth.session-token刷新session,返回session,或输入username与password输出session)
/token (获取ArkoseToken)

目前ws逆向仅支持3.5,4有些问题,看ip纯度,纯度高就能输出

/r/v1/chat/completions method:["GET", "POST", "OPTIONS"]
input:
{
  "model": "gpt-3.5-turbo-16k",
  "messages": [
    {
      "role": "user",
      "content": "what can you do"
    }
  ]
}
output:
{
    "id": "chatcmpl-m3mYrjKTZuoNARfQerON95UJlA9XSWBi",
    "object": "chat.completion",
    "created": 1701011706,
    "model": "gpt-3.5-turbo-16k",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "I can do a wide range of tasks and provide information on various topics. Here are some of the things I can do:\n\n1. Answer Questions: I can provide information on a wide range of topics, including science, history, technology, mathematics, and more.\n\n2. Generate Text: I can generate text for various purposes, such as writing essays, creating stories, composing emails, and more.\n\n3. Language Translation: I can translate text from one language to a