Skip to content

daikaixian/chatapi

 
 

Repository files navigation

Welcome to chatapi 👋

Version License: MIT Twitter: fuergaosi

Chatgpt non-official API Server

This project is still in its very early stages and there may be many problems. I will try to update it as soon as possible.

Install

npm install

Usage

Config

  1. Copy env.example to .env. CAPTCHA_TOKEN is required

    cp env.example .env
  2. Create account.json

    [
        {    
            "email": "username",
            "password": "password"
        }
    ]
  3. Start database

    docker-compose -f docker-compose.db.yml up -d
  4. Seed Database

    npm run seed
  5. Start server

    npm run start
  6. Test API

    • Get bot status
        curl "http://localhost:3000/chatgpt/account"
    • Send message
        curl -X "POST" "http://localhost:3000/chatgpt/sendMessage" \
              -H 'Content-Type: application/json; charset=utf-8' \
              -d $'{
          "message": "Hey!"
        }'
    
    • Send Message with user id

    You can use userId to send message with conversation

      curl -X "POST" "http://localhost:3000/chatgpt/sendMessage" \
            -H 'userId: holegots' \
            -H 'Content-Type: application/json; charset=utf-8' \
            -d $'{
        "message": "Hey!"
      }'
    

Run tests

npm run test

Author

👤 Holegots

Show your support

Give a ⭐️ if this project helped you!

About

Chatgpt non-official API Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 91.3%
  • Dockerfile 4.6%
  • JavaScript 2.3%
  • Shell 1.8%