Currently, there are several user definable variables throughout the script that could be global variables defined at the top.
Example: $OPENAI_CHAT_URL
We utilize the OpenAI API endpoint, but not at the openai.com url. This get simply be changed to a more generic variable name as well with a comment on each of the user variables telling the user what API it needs to hit at that location.
There are several other user definable variables that could be brought to the top of the script to make configuring the script for various situations more obvious.