#ChatGPT Endpoint

1 messages · Page 1 of 1 (latest)

stiff scroll
#

i hope you bring back using chatgpt 4 (Not API) to generate responses and image, even if we had to define the email and password in the .env file without fakeapi or auths.

true lintel
#

the reverse proxy url for librechat should look like this:
CHATGPT_REVERSE_PROXY=http://pandoranext.example.com/proxy_api_prefix/backend-api/conversation

pandoranext.example.com being the server where you deployed it
proxy_api_prefix is the custom "proxy_api_prefix" you've set in the config.json

true lintel
#
  • in the config.json, you need to set your "license_id" (get it here: https://dash.pandoranext.com/) and your "proxy_api_prefix" (it needs to be someting relatively random and long enough or you'll get an error. Don't use special characters that can't be used in a URL)
    • no need to change anything else
      config.json:
{
  "bind": "0.0.0.0: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": "",
  "isolated_conv_title": "*",
  "captcha": {
    "provider": "",
    "site_key": "",
    "site_secret": "",
    "site_login": false,
    "setup_login": false,
    "oai_username": false,
    "oai_password": false
  },
  "whitelist": null
}
#

The default token.json works for our use case
token.json:

{
  "test-1": {
    "token": "access token / session token / refresh token",
    "shared": true,
    "show_user_info": false
  },
  "test-2": {
    "token": "access token / session token / refresh token",
    "shared": true,
    "show_user_info": true,
    "plus": true
  },
  "test2": {
    "token": "access token / session token / refresh token / share token",
    "password": "12345"
  }
}
true lintel
#

same minimum config to use locally in docker:

  • git clone or download latest release: https://github.com/pandora-next/deploy
  • set the config.json according to the instruction above
  • in the librechat .env file use CHATGPT_REVERSE_PROXY=http://host.docker.internal:8181/prefix-in-config/backend-api/conversation
    • ❗replace prefix-in-config with what you've set in the .env file
  • go back to the pandoranext folder and run the command docker-compose up -d
stiff scroll
#

On it🚬

stiff scroll
true lintel
stiff scroll
#

is it just "license_id" and "proxy_api_prefix"?

#

so where i add the ChatGPT auth session? @true lintel

true lintel
stiff scroll
#

i have a lot of things to try with that

true lintel
stiff scroll
#

i will create a repo first and run it locally

true lintel
#

that's also what I did, confirm it's working before making effort to deploy it!

true lintel
#

i think you could easily adapt the method I used on huggingface for render

stiff scroll
#

i always look for the most stable case i can get to though instead of coming back doing the same thing, i improve it more and more

stiff scroll
#

@true lintel any clue?
endpointOption: { model: 'gpt-4', key: null },

true lintel
true lintel
stiff scroll
#

the dropdown it self disappears if i used gpt-4

#

@true lintel

true lintel
true lintel
# stiff scroll yes, so weird

so it's the plus subcription that needs to be enabled...
the repo is all in chinese and I need to use translation tools to try to understand so it's not easy 😅

#

there's the "plus" argument in token.json
maybe try to play with this...

#

there's also this part of their readme that seems to mention 3.5 and 4, with another endpoint

stiff scroll
true lintel
stiff scroll
true lintel
stiff scroll
# stiff scroll <@772921838191116318>

i think that librechat has this issue for long time and you need to recreate the chatgpt browser endpoint, also i'm trying to fix it. @true lintel

#

note that the messages are going successfully to my main account but always showing regenerate button @true lintel

#

also this part remaining in the code getConvo, /* chore: this method is not properly error handled */ getConvoTitle: async (user, conversationId) => { try { const convo = await getConvo(user, conversationId); /* ChatGPT Browser was triggering error here due to convo being saved later */ if (convo && !convo.title) { return null; } else { // TypeError: Cannot read properties of null (reading 'title') return convo?.title || 'New Chat'; } } catch (error) { console.log(error); return { message: 'Error getting conversation title' }; } },

stiff scroll
stiff scroll
#

is there any changes need to be happen on that snippet? @true lintel

true lintel
true lintel
#

@stiff scroll their authentication server keeps timing out on me 😑
lookup dash.pandoranext.com: i/o timeout

#

they blocked my ip 🤦‍♂️

stiff scroll
true lintel
#

I think pandoranext locked my license to the huggingface server IP, and on huggingface I thing OpenAI started blocking the requests to chatgpt 😅 because of that I can't test from anywhere It was a pandoranext issue with my license after all

stiff scroll
true lintel
#

I’m still currently blocked from any testing

stiff scroll
#

also i have a clue, if we delayed the the await until the title come up maybe it fixes it sendMessage(res, { title: await getConvoTitle(user, conversationId), final: true, conversation: await getConvo(user, conversationId), requestMessage: userMessage, responseMessage: responseMessage, });

stiff scroll
true lintel
#

I can’t troubleshoot anymore anyway, there’s a small snow storm here and the electricity keeps going out. I had to turn off my pc

true lintel
hidden rock
#

Is the problem getting the title?

hidden rock
#

Doing so will get your session banned

hidden rock
#

I've gotten banned before doing this

true lintel
true lintel
raw escarp
#

hmmmm i can't seem to configure this properly. First i got that pandora-next issue

#

now it's saying my token is not valid?

#

Do i really need a chatgpt reverse proxy?

true lintel
raw escarp
#

essentially what i've done is take deploy-compose.yml, comment out the client section and then add my chatgpt api key to my env and spin it up

#

i've got plus and api tokens, so... where does that leave me?

#

Oh hi danny, i'm the guy complaining about the portainer stuff in github 😄

hidden rock
#

@raw escarp you need the reverse proxy service from pandora-next. it's one of the few, free options you have to access chat.openai.com. OpenAI is playing a cat-and-mouse game with this

hidden rock
raw escarp
#

np

hidden rock
#

@true lintel maybe we can include a guide on setting up this endpoint? and disable it by default in the same PR? if you dont want to do this don't feel obligated

true lintel
hidden rock
#

oh cool

#

i dont use it, don't have a use case 🥶

true lintel
#

And I'll work on a guide soon, that's the reason I've taken notes on how to set it up here

hidden rock
#

nice!

stiff scroll
#

Changing it to false will makes you on free mode even if you not

#

I guess tbh

#

didn't test making it false yet but i'll get there

#

@true lintel also when everything is encrypted that means you blind tbh 😅

stiff scroll
#

last thing useful I got is the system/user/assistant requests on the backend-api (model=gpt-4) and those there is, if it helps you guys. @hidden rock @true lintel

SYSTEM -> ALL

  "id": "4d1fdf47-097e-4b58-a5d5-7341ebeb37e2",
  "author": {
    "role": "system",
    "name": null,
    "metadata": {}
  },
  "create_time": null,
  "update_time": null,
  "content": {
    "content_type": "text",
    "parts": [
      ""
    ]
  },
  "status": "finished_successfully",
  "end_turn": true,
  "weight": 0,
  "metadata": {},
  "recipient": "all"
}```
USER -> 
```{
  "id": "aaa272b7-659d-407d-b803-97e4e4e0b8bc",
  "author": {
    "role": "user"
  },
  "content": {
    "content_type": "text",
    "parts": [
      "hi"
    ]
  },
  "metadata": {}
}```

ASSISTANT -> ALL
```{
  "id": "0cb34e02-9c59-4237-9f17-b6fa5df77802",
  "author": {
    "role": "assistant",
    "name": null,
    "metadata": {}
  },
  "create_time": 1701709181.832159,
  "update_time": null,
  "content": {
    "content_type": "text",
    "parts": [
      "Hello! How can I assist you today?"
    ]
  },
  "status": "finished_successfully",
  "end_turn": true,
  "weight": 1,
  "metadata": {
    "finish_details": {
      "type": "stop",
      "stop_tokens": [
        100260
      ]
    },
    "is_complete": true,
    "message_type": "next",
    "model_slug": "gpt-4",
    "parent_id": "aaa272b7-659d-407d-b803-97e4e4e0b8bc",
    "timestamp_": "absolute"
  },
  "recipient": "all"
}```
#

@hidden rock @true lintel as you can see there is model_slug that's value is gpt-4 as the model name and another a lot of material to create new great LibreChat endpoint for chatgptbrowser (plus + free).

#

although a total free use case in LibreChat gonna be awesome

hidden rock
stiff scroll
#

that is the problem.

#

there is no <title>ChatGPT</title> under <head> when you scraping the website instantly after you open it, so it's always null

stiff scroll
stiff scroll
hidden rock
#

does pandora-next have a backend-api/conversation/gen_title/ endpoint?

stiff scroll
stiff scroll
true lintel
#

aren't they using the same endpoint for title gen with davinci (which is working fine)?

hidden rock
stiff scroll
#

@hidden rock so why we need pandoranext at all?

true lintel
stiff scroll
#

i hope you figure out @hidden rock

#

this is way better if we did ours 😅

hidden rock
#

what they are doing is against OpenAI terms of use as they are redistributing the same exact code

raw escarp
#

ok so sorry for asking stupid questions but do i or don't i need the proxy/relay if i have plus/paid api?

true lintel
# raw escarp ok so sorry for asking stupid questions but do i or don't i need the proxy/relay...

I recommend using the API key with the OpenAI endpoint: https://platform.openai.com/api-keys

Setting up the proxy to use with your plus subscription, while supported, is against OpenAI ToS.

Also with the proxy method you can currently only use the free davinci model. Other models like gpt-4 and plugins will produce an error.

tl;dr It is best to use a proper API key with the OpenAI endpoint

Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.

raw escarp
#

Ok sweet, thanks

#

That immediately tells me i'm stupid because i put my openai key into my chatgpt key field

#

i obviously don't know the difference 😄

true lintel
raw escarp
#

cool, i got it working 😄

#

ok so for portainer deployment the deploy-compose kindof works

#

It's missing 1 thing which is UID/GID mapping and honestly a LOT of unnecessary volumes

#

volumes:
- /opt/LibreChat/app:/app/client/node_modules:rw
This is literally the only volume i have on the api container

#

because pretty much all of the others are subdirectories of /app. Granted you CAN add additional volumes to the directories if you want to split up where you store stuff but it's kinda over the top

raw escarp
#

About the google authentication. How does that work with a reverse proxy?

#

I'm getting redirected to localhost:3080 although i've set the google callback uri to my domain

#

do i need to change the HOST= perhaps?

#

or the DOMAIN_CLIENT/DOMAIN_SERVER

raw escarp
#

Ok yeah i'm a bit confused, i tried changing both and the HOST= values just to test

#

none of them work 😄

true lintel
raw escarp
#

for some reason it redirects to http maybe?

#

bwaaaaaaaaahhhhh it's all my fault, my reverse proxy is configured with http

#

uri mismatch now but that's also a configuration issue. Will sort that in a bit

true lintel
#

PandoraNext - Translated README.md

PandoraNext Assistant GPTs, if you have a Plus account, you can ask it for help with project issues (do not attempt to extract source code)

Brief Introduction

  • Pandora Cloud + Pandora Server + Shared Chat + BackendAPI Proxy + Chat2API = PandoraNext (Demo Site)
  • Supports GPTs, with the latest UI.
  • Supports various login methods: (equivalent to Pandora Cloud)
    • Account / Password
    • Access Token
    • Session Token
    • Refresh Token
    • Share Token
  • Can integrate tokens (all the above types of tokens can be used), supports setting a password. (equivalent to Pandora Server)
  • Configurable shared tokens, there will be a shared site similar to chat-shared3.zhile.io (currently 2622 regular accounts, 22 Plus).
  • It operates in full proxy mode, your users only need to be able to connect to your deployment network.
  • Can be started in BackendAPI Proxy mode, directly using the Access Token to call /backend-api/ interface.
  • Still have questions? Then join the Telegram group and let everyone have a look: @ja_netfilter_group

Manual Deployment

  • Download the package suitable for your operating system and architecture from Releases.
  • Unzip and modify the config.json file in the same directory to the parameters you need.
  • Obtain license_id and fill it in the config.json, this is a necessary prerequisite step!
  • Launch with ./PandoraNext for various Linux/Unix systems.
  • Double-click PandoraNext.exe for Windows, but of course, it is best to start in cmd.

Docker Compose Deployment

  • The repository already contains relevant files and directories, pull them to local, obtain license_id and fill it in data/config.json.
  • data directory contains example files of config.json, tokens.json that you can modify.
  • docker-compose up -d launches the service!

Docker Deployment

$ docker pull pengzhile/pandora-next
$ docker run -d --restart always --name PandoraNext --net=bridge \
    -p 8181:8181 \
    -v ./data:/data \
    -v ./sessions:/root/.cache/PandoraNext \
    pengzhile/pandora-next
  • The container listens on port 8181 by default, mapping the host's 8181 port and can be modified.
  • You can map a directory to /data directory within the container, and config.json, tokens.json as well as obtain license_id are filled in config.json.
  • You can map a directory to /root/.cache/PandoraNext directory within the container to retain login session, avoiding loss of login state on container restart.
#

Nginx Configuration

server {
    listen 443 ssl http2;
    server_name chat.zhile.io;
    
    charset utf-8;
    
    ssl_certificate      certs/chat.zhile.io.crt;
    ssl_certificate_key  certs/chat.zhile.io.key;

    ...other configurations omitted...
    
    location / {
        proxy_http_version     1.1;
        proxy_pass         http://127.0.0.1:8181/;
        proxy_set_header    Connection        "";
        proxy_set_header       Host            $http_host;
        proxy_set_header     X-Forwarded-Proto     $scheme;
        proxy_set_header       X-Real-IP              $remote_addr;
        proxy_set_header       X-Forwarded-For        $proxy_add_x_forwarded_for;
        
        proxy_buffering off;
        proxy_cache off;
        
        send_timeout 600;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
    }

    ...other configurations omitted...
}
  • It's recommended to enable http2 in Nginx.
  • The above is only a suggested configuration and can be altered based on the actual situation.
  • It is advisable to enable ssl a.k.a https, otherwise browser restrictions will prevent copying of webpage content.

config Configuration

  • Below is an example config.json file:
{
  "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": "",
  "isolated_conv_title": "*",
  "captcha": {
    "provider": "",
    "site_key": "",
    "site_secret": "",
    "site_login": false,
    "setup_login": false,
    "oai_username": false,
    "oai_password": false
  },
  "whitelist": null
}
#
  • bind specifies binding IP and port. Inside docker, only 0.0.0.0 can be used as the IP, otherwise, it won't map outside.
  • If you do not intend to wrap with nginx or other reverse proxies, the IP in the bind parameter should be set to 0.0.0.0!!!
  • tls configures PandoraNext to start directly with https.
    • enabled - Whether to enable, true or false. When enabled, the certificate and key file paths must be configured.
    • cert_file - Path to the certificate file.
    • key_file - Path to the key file.
  • timeout is the request timeout in seconds.
  • proxy_url specifies to send service traffic through a proxy, e.g., http://127.0.0.1:8888, socks5://127.0.0.1:7980
  • license_id specifies your License Id, which can be obtained here.
  • public_share For conversations created in GPT, whether login is required to view them. true means login is not required for viewing.
  • site_password sets the whole site password, you need to enter this password first, correct entry allows you to carry out subsequent steps. Fully ensures privacy.
  • setup_password defines a setup password, used for calling /setup/ starting setup interfaces, if empty then not callable.
  • server_tokens sets whether to show the version number in the response header, true to show, false not to show.
  • proxy_api_prefix can add a prefix to your proxy mode interface addresses, making them unexpected. Be mindful that the prefix should be characters allowed in URLs. Including: a-z A-Z 0-9 - _ . ~
  • proxy_api_prefix you must set a prefix of no less than 8 characters, and containing both numbers and letters to enable proxy mode!
    • /backend-api/conversation proxy mode ratio 1:4
    • /v1/chat/completions 3.5 model ratio 1:4
    • /v1/chat/completions 4 model ratio <t:1701843000:t>, no need for coding
    • /api/auth/login login interface ratio 1:100, no need for coding
  • isolated_conv_title It is now possible to set a title for isolated sessions, rather than the uniform *.
  • captcha configures captchas on some critical pages.
    • provider - captcha provider, supporting: recaptcha_v2, recaptcha_enterprise, hcaptcha, turnstile, friendly_captcha.
    • site_key - Website parameter obtained from the captcha provider's backend, publicly disclosable information.
    • site_secret - Secret parameter obtained from the captcha provider's backend, do not disclose. Some providers also call it API Key.
    • site_login - whether to show captcha on the full site password login interface, true or false.
    • setup_login - whether to show captcha on the setup entry login interface, true or false.
    • oai_username - whether to show captcha on the username input interface, true or false.
    • oai_password - whether to show captcha on the password input interface, true or false.
  • whitelist - array of emails specifies which users can login and use, username/password login is restricted, all token logins are restricted. Built-in tokens are not restricted.
  • whitelist set to null means no restrictions, an empty array [] means all accounts are restricted, built-in tokens are not restricted.
  • An example of whitelist: "whitelist": ["[email protected]", "[email protected]"]
#

tokens Configuration

  • Below is an example tokens.json file:
{
  "test-1": {
    "token": "access token / session token / refresh token",
    "shared": true,
    "show_user_info": false
  },
  "test-2": {
    "token": "access token / session token / refresh token",
    "shared": true,
    "show_user_info": true,
    "plus": true
  },
  "test2": {
    "token": "access token / session token / refresh token / share token",
    "password": "12345"
  }
}
  • token supports all types written in the example file. session token and refresh token can auto-refresh.
  • Each key is called a token key, which can be entered in the login box as username. As above: test-1, test-2, etc., change at will.
  • If password is set, then after entering the token key, you proceed to the password input page to enter the matching password.
  • If shared is set to true, then this account will appear in /shared.html, and a link to it will appear on the login page.
  • If shared is set to true, then this account can no longer log in through the username login box.
  • Accounts in /shared.html have the same functionality as the shared site, and you can set an isolation password for session isolation.
  • plus is used to mark on /shared.html whether the account has golden light, no other purpose.
  • show_user_info indicates whether to display account email information when shared on /shared.html, it is recommended to enable for GPTs.

proxy Mode Interfaces

  • /backend-api/* ChatGPT web version interface, see more on the page with F12.
  • /public-api/* ChatGPT web version interface, see more on the page with F12.
  • GET /api/token/info/fk-xxx to get share token information, use the access token of the generator as the Authorization header, you can view the usage of different models.
  • POST /api/auth/session to obtain access token via session token, use urlencode form to pass session_token parameter.
  • POST /api/auth/refresh to obtain access token via refresh token, use urlencode form to pass refresh_token parameter.
  • POST /api/auth/login to login and get access token, use urlencode form to pass username and password parameters.
  • POST /api/token/register to generate share token
  • POST /api/pool/update to generate an update pool token
  • POST /v1/chat/completions to use ChatGPT API mimic request interface, supporting share token and pool token.
  • All of the above addresses need to be prefixed with /<proxy_api_prefix>, which is the prefix you set.
#

Setup Interface

  • You must first set setup_password in config.json to be non-empty!
  • Open in browser: <Base URL>/setup, where <Base URL> is the address of your deployed service.

About license_id

  • Obtain here: https://dash.pandoranext.com
  • Copy the content after License Id:, fill it in the license_id field in config.json.
  • Make sure not to copy any unnecessary spaces or invisible characters.
  • If license_id is not filled in config.json, starting will cause an error License ID is required.
  • In case of no fixed IP, it will automatically try to pull again when the IP changes.
  • If you are launching web and proxy modes at the same time, they must share a license.jwt, in this case, it's recommended to pull manually!

Other Notes

  • If you find that you cannot copy on the webpage, enable https or use 127.0.0.1.
  • If you are customizing page elements, please retain:
    • The text and link of Powered by PandoraNext.
    • The text and link of About PandoraNext.
  • If you want to wipe it, remove several dom detection codes in more than a hundred js files.
  • I won't say what the consequences of wiping will be.
  • PHP is the best programming language in the world.
edgy dew
#

I have a problem. An error started showing up today:

Something went wrong. Here's the specific error message we encountered: Error message: "Cannot set properties of null (setting 'title')"

This is only on GPT4 model.
3.5 works fine.
Panodra is set up fine, yesterday everything was working fine.
My env settings:

ENDPOINTS=chatGPTBrowser,gptPlugins
OPENAI_TITLE_MODEL=gpt-3.5-turbo
CHATGPT_MODELS=text-davinci-002-render-sha,gpt-4
CHATGPT_REVERSE_PROXY=http://host.docker.internal:8181/prefix/backend-api/conversation

Request failed with response: {"error":"Conversation not found"}

hidden rock
edgy dew
#

Here is log:

ask log {
  userMessage: {
    messageId: '43c53e0c-07a8-4979-809d-3c555c08d973',
    sender: 'User',
    text: 'Hello',
    parentMessageId: '00000000-0000-0000-0000-000000000000',
    conversationId: '6d5ac3ea-90f7-4a2e-a2a7-bb279c6743f1',
    isCreatedByUser: true
  },
  endpointOption: { model: 'gpt-4', key: null },
  conversationId: '6d5ac3ea-90f7-4a2e-a2a7-bb279c6743f1'
}
[Meilisearch] Convo not found and will index 6d5ac3ea-90f7-4a2e-a2a7-bb279c6743f1

My token sets on server envs

true lintel
edgy dew
edgy dew
hidden rock
#

I think I know the issue but will have to setup pandora to debug so give me a couple moments

edgy dew
#

One more thing:
If i open Pandora web-interface and try from here - its working, with gpt4

hidden rock
#

@true lintel is this enough for it to work?

{
  "test-1": {
    "token": "my token",
    "shared": false,
    "show_user_info": false
  },
  "test-2": {
    "token": "my token",
    "shared": false,
    "show_user_info": false,
    "plus": true
  },
  "test2": {
    "token": "access token / session token / refresh token / share token / username & password",
    "password": "12345"
  }
}
#

do they all need to be filled out? this part wasnt clear

true lintel
hidden rock
#

so i provide session token any where or no?

true lintel
hidden rock
#

interesting i thought you could provide your own session tokens

true lintel
edgy dew
true lintel
edgy dew
hidden rock
true lintel
hidden rock
#

@edgy dew yes it's from OpenAI. gpt-3 doesnt get moderated but gpt-4 does. I'm not sure I can fix this atm. it might be as simple as adding more headers to the request but authentication is definitely a lot tighter with plus models. everything pandora does is proxied which is really sus too.. they're able to generate your openAIId, and refresh token just from a session token, and authentication is processed externally

it's obvious they are pinging an external server which is why the license id and there are "shared" functionalities. Im trying to pick at the image they have encoded. which again is also suspicious, they wanna keep their methods secret

hidden rock
#

@edgy dew @true lintel careful using this as they could easily fetch/store all your conversations

#

your session can be renewed by logging out and back in on the official site

edgy dew
edgy dew
#

@hidden rock @true lintel I see some updates in Pandora repo, and new release 8 hours ago. Maybe it help.
New:

/api/arkose/token - get arkose_token,proportion1:10
POST /api/arkose/token gets arkose_token, currently only supports gpt-4type. Use the urlencode form to pass the type=gpt-4 parameter. After obtaining, it can be called via APIGPTs

Now i try to update Pandora on my install

edgy dew
edgy dew
#

Hi.
Last release(v0.5.3) of PandoraNext fix all issues.
Now GPT4 working with LibreChat