/ChatGPT-API-Demo

ChatGPT API Demo

Primary LanguagePython

ChatGPT API Demo

Installation

  1. Install dependencies
pip install -r requirements.txt
  1. Create a new .env file write API key
OPENAI_API_KEY = '[YOUR_API_KEY]'

Usage

Use ChatGPT with Flask

Start app

python -m flask --app app.py run

then test

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"message":"Hello"}' \
  http://127.0.0.1:5000/chat

More detail: Develop an Intelligent Chat Program Using Python and ChatGPT API

Use ChatGPT API

py api.py

More detail: Python + ChatGPT API Development | Based on gpt-3.5-turbo model