Member-only story
Cracking Open the OpenAI (Python) API
A complete beginner-friendly introduction with example code
This is the 2nd article in a series on using Large Language Models (LLMs) in practice. Here I present a beginner-friendly introduction to the OpenAI API. This allows you to go beyond restrictive chat interfaces like ChatGPT and to get more out of LLMs for your unique use cases. Python example code is provided below and at the GitHub repository.
Table of Contents:
- What’s an API?
- OpenAI’s (Python) API
- Getting Started (4 Steps)
- Example Code
In the first article of this series, I described Prompt Engineering as the most accessible way to use LLMs in practice. The easiest (and most popular) way to do this is via tools like ChatGPT, which provide an intuitive, no-cost, and no-code way to interact with an LLM.
However, this ease of use comes at a cost. Namely, the chat UI is restrictive and does not translate well to many practical use…

