Introduction: How to Set Up Python to Interact With ChatGPT

About: Occupation: tech support

How to Set Up Python to Interact With ChatGPT
Text below and PDF attached

Get OpenAI API key:
- Go to platform.openai.com and login
- Click on lock symbol "API Keys > Create OpenAI API key
- Copy API key to text file and save
- Click on "Usage" > Purchase $5 worth of compute time

Install Python:
- Go to Python.org
- Downloads > Windows > Latest Python 3 Release - Python 3.12.2 > Scroll down > Windows installer (64 bit) > Download
- Double click on Python executable to start Python installation
- Check "Add python.exe to PATH"
- Customize Installation
- Optional Features > check "pip"
- Advanced Options > check "Add Python to environment variables"
- Install

Post install:
- Open Powershell prompt
- pip install openai [hit Enter]
- pip install -U python-dotenv [hit Enter]
- pip install openai==0.28 [hit Enter]

In Python file:
import openai
import os

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

os.environ['OPENAI_API_KEY'] = "PUT IN YOUR INDIVIDUAL API KEY THAT BEGINS WITH SK-"

openai.api_key = os.getenv('OPENAI_API_KEY')

print ("My OpenAI API key is: ", openai.api_key)

Step 1: How to Set Up Python to Interact With ChatGPT

How to Set Up Python to Interact With ChatGPT
Text below and PDF attached

Get OpenAI API key:
- Go to platform.openai.com and login
- Click on lock symbol "API Keys > Create OpenAI API key
- Copy API key to text file and save
- Click on "Usage" > Purchase $5 worth of compute time

Install Python:
- Go to Python.org
- Downloads > Windows > Latest Python 3 Release - Python 3.12.2 > Scroll down > Windows installer (64 bit) > Download
- Double click on Python executable to start Python installation
- Check "Add python.exe to PATH"
- Customize Installation
- Optional Features > check "pip"
- Advanced Options > check "Add Python to environment variables"
- Install

Post install:
- Open Powershell prompt
- pip install openai [hit Enter]
- pip install -U python-dotenv [hit Enter]
- pip install openai==0.28 [hit Enter]

In Python file:
import openai
import os

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

os.environ['OPENAI_API_KEY'] = "PUT IN YOUR INDIVIDUAL API KEY THAT BEGINS WITH SK-"

openai.api_key = os.getenv('OPENAI_API_KEY')

print ("My OpenAI API key is: ", openai.api_key)