From the course: OpenAI API for Python Developers

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Configure the project: Set up an API key

Configure the project: Set up an API key

From the course: OpenAI API for Python Developers

Configure the project: Set up an API key

- [Instructor] Now we want to configure the project with OpenAI. So you see that I have here added a few spots that you need to complete with code. First we want to load the environment variable and set up an API key and also define here the language model that we want to interact with. So let's find examples and instructions from the documentation. And actually we're going to check out here an example of how to set up a starter project. We're going to select from here, generate, and this first example, and you want to make sure that you select the Python library. So what you want to do first is to add to the scope the OpenAI library, then create a new object. Finally, define a prompt. But before you do that you want to set up an API key to be authorized to send requests. So you're going to do that from the left, select API keys, and from here you're going to be able to create your new secret key. I'm going to select this. So defining a name is optional, so I'm just going to click…

Contents