This project provides a proxy for the ChatGPT API using Flask and Heroku. It allows you to send requests from your local environment to your deployed Heroku app, which then forwards those requests to OpenAI's ChatGPT API.
Step 1: Install the Heroku CLI if you haven't already. Step 2: Authenticate with Heroku:
heroku login
Step 1: Install the necessary Python packages:
pip install flask requests
Step 2: Save the provided server side code as proxy_server.py.
Step 3: Save the provided local code as local_request.py.
Step 1: In your project directory, initialize git and create a Heroku app:
git init
heroku create your-heroku-app-name
Step 2: Commit all files:
git add .
git commit -m "Initial commit"
Step 3: Push the code to Heroku:
git push heroku master
Step 4: Start a Heroku dyno:
heroku ps:scale web=1
Step 1: In local_request.py, replace YOUR_OPENAI_API_KEY_HERE with your OpenAI API key. Step 2: Replace https://your-heroku-app-name.herokuapp.com with the URL of your app on Heroku. Step 3: Run local_request.py and follow the prompts to input text.
heroku logs --tail