diff --git a/chatgpt.sh b/chatgpt.sh index 81df29a..d543acf 100755 --- a/chatgpt.sh +++ b/chatgpt.sh @@ -13,11 +13,18 @@ PROCESSING_LABEL="\n\033[90mProcessing... \033[0m\033[0K\r" OVERWRITE_PROCESSING_LINE=" \033[0K\r" if [[ -z "$OPENAI_KEY" ]]; then - echo "You need to set your OPENAI_KEY to use this script" + echo "You need to set your OPENAI_KEY and OPENAI_BASE_URL(optional) to use this script" echo "You can set it temporarily by running this on your terminal: export OPENAI_KEY=YOUR_KEY_HERE" exit 1 fi +if [[ -z "$OPENAI_BASE_URL" ]]; then + OPENAI_BASE_URL="https://api.openai.com" + echo "Use official api url." +else + echo "Use \"${OPENAI_BASE_URL}\" as api url." +fi + usage() { cat <