- download rename this file to chat.py
- create virtualenv: python3 -m venv openai
- source openai/bin/activate
- pip install openai
- get api key: https://platform.openai.com/account/api-keys and config api token ~/.config/openai.json
{"token":"openai-token"}
- python chat.py
- if you dont want every time source virtual env, replace header
#!/usr/bin/env python3
with openai env python absolute path#!/home/xxx/openai/bin/python