Giter VIP home page Giter VIP logo

chatgpt-token's Introduction

chatgpt-token

A npm package to get chatgpt token by your username and password.

Unavaliable Now

https://github.com/transitive-bullshit/chatgpt-api#update-december-11-2022

Requirement

This package use playright to simulate login behavior, and use chromium hardless mode.

so you need to install chromium first.

npx playwright install chromium

Uages

npm install chatgpt-token
// cjs
const {chatgptToken} = require("chatgpt-token")
// mjs
import {chatgptToken} from "chatgpt-token/module"

(async function(){
  const token = await chatgptToken('username','password')
  if (!token) {
    console.log("error")
  } else {
    console.log(token)
  }
})()

HTTP API Server

I also write a http server to do this thing, and it has a docker image to easily deploy. Here is:

chatgpt-token's People

Contributors

mereithhh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chatgpt-token's Issues

Not working

Error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

page.waitForSelector: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for locator('#password') to be visible
============================================================

Code:

import { ChatGPTAPI } from "chatgpt";
import { chatgptToken } from "chatgpt-token/module";
import * as dotenv from "dotenv"; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config();

var api;

async function initChat() {
  const token = await chatgptToken(process.env.USERNAME, process.env.PASSWORD);
  if (!token) {
    console.log("error");
  } else {
    console.log(token);
    api = new ChatGPTAPI({
      sessionToken: token,
    });
    // ensure the API is properly authenticated
    await api.ensureAuth();
  }
```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.