Mac Classic

Set up your own customised proxy server for LegacyAI with the following steps.
This guide assumes you are using Mac OS and will be hosting the server application on Heroku.

LegacyAI

LegacyAI

Manticore Software

LegacyAI allows older Apple computers to interact with AI services like OpenAI's ChatGPT. LegacyAI works across 15 different Mac systems, from System 7 to 10.11 (El Capitan).

Proxy Server Setup

  1. Open your terminal and Install the Heroku CLI. Follow the installation instructions provided in the Heroku documentation.
     
  2. Install Python 3.6 or newer.
     
  3. Create a new directory for your project and navigate to it in your terminal:
    mkdir heroku-proxy-server
    cd heroku-proxy-server
    

     

  4. Create a virtual environment and activate it:
    python3 -m venv venv
    source venv/bin/activate
    

     

  5. Install Flask and gunicorn:
    pip install Flask gunicorn
    

     

  6. Create a new file named app.py with the content from the GitHub repository.
    Make sure you have set the environment variable API_KEY within Heroku to your actual OpenAI API key. You can configure this at the dashboard of your Heroku app under Config Vars

     
  7. Create another file named Procfile (make sure you save it without any file extension). Add the following content to the Procfile:
    web: gunicorn app:app
    
    

     

  8. Create a requirements.txt file with the following content to specify the project's dependencies:
    click==8.1.3
    Flask==2.1.1
    requests==2.26.0
    gunicorn==20.1.0
    itsdangerous==2.1.2
    Jinja2==3.1.2
    MarkupSafe==2.1.2
    Werkzeug==2.2.3
    
    

     

  9. Now that the project has been built, it needs to be deployed to Heroku. To do this you need to Initialize a Git repository within your project folder:
    git init
    
    

     

  10. Create a .gitignore file to exclude unnecessary files from being uploaded:
    venv/
    __pycache__/
    *.pyc
    *.pyo
    *.pyd
    *.pyc
    *.egg-info/
    dist/
    build/
    *.egg
    
    

     

  11. Commit the project files to the Git repository:
    git add .
    git commit -m "Initial commit"
    
    

     

  12. Log in to your Heroku account:
    heroku login
    
    

     

  13. Create a new Heroku app replacing your-app-name with a name for your Heroku proxy server:
    heroku create your-app-name
    
    

     

  14. Deploy the application to Heroku:
    git push heroku master
    
    

    After the deployment, and subsequent build on Heroku is complete, your proxy server will be live on Heroku at:
    https://your-app-name.herokuapp.com/openai-proxy

  15. After confirming your proxy server URL is correct, you can enter this into LegacyAI and test the functionality of your server.


Logging Server Activity

To log activity on your server, run the following command in your terminal:

heroku logs --app your-app-name --tail

 

Making Changes

Whenever you make changes to your application, you need to commit and deploy these changes to Heroku. The following commands stage your changes, commits them, and pushes them to the remote repository. Whenever you push any changes your server application will be redeployed on Heroku. Note that this restarts your server which will result in temporary down-time.

git add .
git commit -m ""
git push heroku master


PR Requests

Feel free to add PR requests to the public example server's repository.

Note:

Heroku has a maximum request timeout of 30 seconds. This causes issues when the OpenAI API takes longer than 30s to prepare a response. Ideally once you've got your server setup and in a working state you should look at moving it to a different platform.

Post a Comment