PawanOsman / ChatGPT.Net

C# library for ChatGPT using official OpenAI API

Home Page:https://www.nuget.org/packages/ChatGPT.Net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get SessionToken?

qcjxberin opened this issue · comments

How to get SessionToken?

First, you need to open the ChatGPT website and log in. Then open the inspection menu, right-click inspect and go to the application tab, then cookies and there you will find the __Secure-next-auth.session-token. But you can also use the API key, which can be found here: https://platform.openai.com/account/api-keys.

Can I use API keys to be context-sensitive?

In addition, do you need to manually obtain the SessionToken every time, is there a way to obtain it automatically

In addition, do you need to manually obtain the SessionToken every time, is there a way to obtain it automatically

there are some libraries doing it but not reliable
session token can last for 7 days, you can renew it every 7 days