English | 中文
This project guides you through the initial steps of developing applications using the OpenAI API. It will help you setup your development environment, understand how to use the API, and provide you with a working Jupyter Lab notebook for interactive development.
Here are the steps to get your development environment ready:
In order to use the OpenAI API, you need to have an API key which can be obtained from the OpenAI dashboard. Once you have the key, you can set it as an environment variable:
For Unix-based systems (like Ubuntu or MacOS), you can run the following command in your terminal:
export OPENAI_API_KEY='your-api-key'
For Windows, you can use the following command in the Command Prompt:
set OPENAI_API_KEY=your-api-key
Make sure to replace 'your-api-key'
with your actual OpenAI API key.
You can clone the OpenAI Quickstart repository to your local machine using the following command:
git clone https://github.com/DjangoPeng/openai-quickstart.git
This will create a directory named 'openai-quickstart' in your current directory.
We will be using Jupyter Lab as our interactive development environment. You can install it using pip:
pip install jupyterlab
Navigate to the 'openai-quickstart' directory and start Jupyter Lab by running the following command:
cd openai-quickstart
jupyter lab
This will start Jupyter Lab and open it in your default web browser.
Now, you are ready to start developing with the OpenAI API!