CoderBuck / chatgpt_api_dart

Dart client for the unofficial ChatGPT API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChatGPT API Dart

Dart client for the unofficial ChatGPT API

Ported from https://github.com/transitive-bullshit/chatgpt-api

Intro

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...

How it works

This package requires a valid session token from ChatGPT to access it's unofficial REST API.

To get a session token:

  1. Go to https://chat.openai.com/chat and log in or sign up.
  2. Open dev tools.
  3. Open Application > Cookies
  4. 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.

Status

This project was a very quick port of the node version, it requires testing and changes to make it more robust and useable.

Development

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';

About

Dart client for the unofficial ChatGPT API

License:MIT License


Languages

Language:C++ 34.1%Language:CMake 30.4%Language:Dart 28.1%Language:HTML 3.0%Language:C 2.3%Language:Swift 1.9%Language:Kotlin 0.2%Language:Objective-C 0.1%