This repository contains a beginner-friendly notebook to use an API to interact with OpenAI LLM models. The repository was created for members of the Harvard community who have received an OpenAI API Key from the HUIT Academic Technology Team.
If you already have your API Key, let's dive in! If not, learn more about the process to obtain a key here.
Why use an API to access AI models?
- An API, or Application Programming Interface, is simply a method to interact with software, like AI models, using code. Using the OpenAI API in this notebook, you will learn to unlock power model features and gain the skills to create, analyze, and experiment with these models—your way.
You don't need to be an expert to use these notebooks. Just follow the steps below, and you'll be running your first AI model in minutes.
Best of all, no coding experience is required!
Let's begin.
Choose the best option for you to begin working with the notebooks.
Option 1: Open and Run in Colab (Recommended)
This is the fastest and easiest way to start. Just click the button below, and the notebook will open directly in your browser. You don't need to install anything!
Option 2: Run Locally
If you prefer to run the notebook on your own computer, you can download the repository from GitHub. See the Local Setup section below.
This repository is organized by provider and use case. Each folder contains notebooks with simple examples to get you started.
getting-started/: A notebook covering API key setup and a basic introduction.
This section is for users who chose to run the notebooks locally.
- Clone the Repository:
git clone https://github.com/Harvard-ATG/generative-ai-api-starter-notebook.git - Navigate into the Project Folder:
cd generative-ai-api-starter-notebook - Begin with the Getting Started notebook:
getting_started.ipynb
For security, never share your API key or save it directly in your notebook. Instead, use a secure method like an environment variable locally, or secrets on Colab. The getting-started.ipynb notebook will show you how to do this for your very first run.
If you have any questions, feel free to open an issue or reach out to [email protected]