pandora-next详细使用

由于时效问题,该文某些代码、技术可能已经过期,请注意!!!本文最后更新于:9 个月前

如题

项目地址 https://github.com/pandora-next/deploy

免费共享的GPT地址:https://chat-shared3.zhile.io/shared.html?v=2

这里共享了2622个普通号和22个gpt4 plus号,而且完全免费,包括gpt4 plus。使用方法也很简单,随便看中哪个小框框点进去,再随便设置个密码就可以进去了。
关于4.0plus版(冒金光的就是4.0,其他都是普通版):plus版貌似不是都能用, 如何判断冒金光的哪个能用?个人总结:冒着金光而且框框发红的应该就可以用,虽然用的人多。冒着金光但是框框是绿的大概率就不能用,绿色代表用的人少,毕竟是4.0,而且免费,怎么可能会人少呢,除非不能用。

自行部署

这个项目如果自己有账号也可以自行部署,全程无需科学上网(感谢大佬提供的代理服务)。
不过自行部署也是有额度限制的(根据自己的github账号注册时长限制每天多少条提问的额度)

PS: 根据项目文档也可以0额度消耗使用,比如下面两种登录方式,test1登录每提问一个消耗一个额度,使用test2登录,提问不消耗额度。

1
2
3
4
5
6
7
8
9
10
11
{
"test1": {
"token": 'access_token',
"shared": false,
"show_user_info": false
},
"test2": {
"token": "用户名,密码",
"password": "12345" ## 此密码可以随便填,主要用于页面登录
}
}

另外如果部署后想用脚本批量提问也是可以的,不过使用后端api提问貌似都是要消耗额度(登录是最消耗额度的,相当于提问了100个)。
部分后端API使用方法如下(下面url地址里的test123456是config.json里的proxy_api_prefix):
config.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
"bind": "127.0.0.1:8181",
"tls": {
"enabled": false,
"cert_file": "",
"key_file": ""
},
"timeout": 600,
"proxy_url": "",
"license_id": "", ## 这个就是用来获取额度的
"public_share": false,
"site_password": "",
"setup_password": "",
"server_tokens": true,
"proxy_api_prefix": "test123456",
"isolated_conv_title": "*",
"captcha": {
"provider": "",
"site_key": "",
"site_secret": "",
"site_login": false,
"setup_login": false,
"oai_username": false,
"oai_password": false
},
"whitelist": null
}
  • POST /api/auth/login 登录获取access token,需要使用urlencode form传递username 和 password 参数。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    # curl 版
    curl -X POST http://127.0.0.1:8181/test123456/api/auth/login \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "username=***&password=***"

    # python版
    import requests

    url = "http://127.0.0.1:8181/test123456/api/auth/login"
    data = {
    "username": "你的用户名",
    "password": "你的密码"
    }
    headers = {
    "Content-Type": "application/x-www-form-urlencoded"
    }

    response = requests.post(url, data=data, headers=headers)

    print(response.text)

    该请求可以获得access token 和 session token,关于各种token可查看该文档:https://fakeopen.org/Token/Access.html

  • POST /api/auth/session 通过session token获取access token,使用urlencode form传递session_token参数。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    # curl 版
    curl -X POST http://127.0.0.1:8181/test123456/api/auth/session \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "session_token=***"

    # python版
    import requests

    url = "http://127.0.0.1:8181/test123456/api/auth/session"

    payload = {
    'session_token': '***' # 替换 *** 为你的 session_token
    }

    headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
    }

    response = requests.post(url, headers=headers, data=payload)
    print(response.text)
  • POST /api/token/register 生成share token ,需要使用urlencode form传递unique_name (unique_name随便填就可)和 access_token 参数。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    # curl 版
    curl -X POST http://127.0.0.1:8181/test123456/api/token/register
    -H "Content-Type: application/x-www-form-urlencoded"
    -d "unique_name=***&access_token=***"

    # python版
    import requests

    url = "http://127.0.0.1:8181/test123456/api/token/register"
    payload = {
    "unique_name": "你的unique_name", # 替换为你的实际 unique_name
    "access_token": "你的access_token" # 替换为你的实际 access token
    }
    headers = {
    "Content-Type": "application/x-www-form-urlencoded"
    }

    response = requests.post(url, data=payload, headers=headers)

    print(response.text)

    另外share token也可在这个地址获取:https://ai.fakeopen.com/token

  • POST /v1/chat/completions 使用ChatGPT模拟API的请求接口,支持share token和pool token。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    # curl 版
    curl -X POST 'http://127.0.0.1:8181/test123456/v1/chat/completions' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer share_token' \
    -d '{
    "model": "gpt-3.5-turbo",
    "messages": [
    {
    "role": "system",
    "content": "you are a helpful assistant"
    },
    {
    "role": "user",
    "content": "hello"
    }
    ],
    "temperature": 0.7
    }'

    # python版
    import requests
    import json

    url = 'http://127.0.0.1:8181/test123456/v1/chat/completions'
    headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer share_token' # 替换 'share_token' 为你的实际共享令牌
    }
    data = {
    'model': 'gpt-3.5-turbo',
    'messages': [
    {
    'role': 'system',
    'content': 'you are a helpful assistant'
    },
    {
    'role': 'user',
    'content': 'hello'
    }
    ],
    'temperature': 0.7
    }

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

    print(response.text)
  • /backend-api/* ChatGPT网页版接口(暂时没搞明白怎么请求,先留个坑)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    import uuid
    auth0_url = "http://127.0.0.1:8181/backend-api/conversation"

    headers = {
    'X-Authorization':'Bearer xxx',
    'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
    'Content-Type': 'application/json',
    'Accept': 'text/event-stream',
    'Host':'127.0.0.1:8181',
    'Origin':'http://127.0.0.1:8181',
    'Referer':'http://127.0.0.1:8181',
    'Proxy-Connection':'keep-alive',
    'Cookie': ''
    }


    model = "text-davinci-002-render-sha"
    prompt = 'hello'

    data = {
    "action": "next",
    "messages": [{"id": str(uuid.uuid4()), "role": "user", "content": {"content_type": "text", "parts": [prompt]}}],
    "conversationId": str(uuid.uuid4()),
    "parentMessageId": str(uuid.uuid4()),
    "model": model
    }
    res = requests.post(url=auth0_url, headers=headers, json=data)
    print(res.text)