Dart client for the unofficial ChatGPT API
Ported from https://github.com/transitive-bullshit/chatgpt-api
This package is a Dart wrapper around ChatGPT by OpenAI.
You can use it to start building projects powered by ChatGPT like chatbots, websites, etc...
demo.mp4
This package requires a valid session token from ChatGPT to access it's unofficial REST API.
To get a session token:
- Go to https://chat.openai.com/chat and log in or sign up.
- Open dev tools.
- Open
Application
>Cookies
- Copy the value for
__Secure-next-auth.session-token
and save it to your environment.
When you create the GptChatApi
client, pass it this token.
This project was a very quick port of the node version, it requires testing and changes to make it more robust and useable.
Create these files and add your session token to run the tests and example respectively:
test/session_token.dart
example/lib/session_token.dart
Should look something like this:
const SESSION_TOKEN = 'my session token from https://chat.openai.com/chat';