/chatapi

Chatgpt non-official API Server

Primary LanguageTypeScriptMIT LicenseMIT

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. (You shouldn't have to change anything

    cp env.example .env
  2. Create apikey.json

    [
        "<Your API Key>",
    ]
  3. Start database

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

    npx run migrate:deploy && npm run seed
  5. Start server

    npm run start
  6. Test API

    • Get bot status
        curl "http://localhost:3000/chatgpt/account"
    • Send One Time message
        curl -X "POST" "http://localhost:3000/chatgpt/message" \
              -H 'Content-Type: application/json; charset=utf-8' \
              -d $'{
          "message": "Hey!"
        }'
    
    • Send Session message (Auto save context)
            curl -X "POST" "http://localhost:3000/chatgpt/message/<session_id>" \
              -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!