A Simple Guide to The (New) ChatGPT API with Python

ChatGPT API was just released. Explore everything you can do with the ChatGPT API in Python.

The PyCoach
Geek Culture

--

Image via Shutterstock under license to Frank Andrade

OpenAI just released ChatGPT API. This is an API that calls gpt-3.5-turbo, which is the same model used in the ChatGPT product.

For those already familiar with the OpenAI API in Python, learning how to use the ChatGPT API should be simple, but there are still some concepts that are exclusive to this API that we’ll learn in this guide.

Let’s explore the ChatGPT API in Python.

Note: The API is priced at $0.002 per 1K tokens. You have free credit to use, though. It seems now I have another reason to cancel my ChatGPT Plus subscription.

Generate Your API Key

Before we start working with the ChatGPT API, we need to login into our OpenAI account and generate our API keys.

Remember that OpenAI won’t display your secret API key again after you generate it, so copy your API key and save it. I’ll create an environment variable named OPENAI_API_KEY that will contain my API key for…

--

--

The PyCoach
Geek Culture

My ChatGPT Course - ChatGPT Unleashed: Master GPT-4 & Prompt Engineering: bit.ly/chatgpt-pycoach