📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

How to Get an OpenAI Api Key

Postman3:49

Transcription

From zero to AI hero, here's the fastest route to making your first OpenAI API [Music] call.

Hey everyone, Sterling here. Today I'm going to walk you through the steps of getting your OpenAI API key all the way to making your first request inside of Postman. Let's dive in.

First things first, you're going to need an OpenAI account. Head to openai.com and set up your account. Now that you're logged in, head over to platform.openai.com. And in the upper right, you're going to hit start building. You can fill in your information. We'll say I'm somewhat technical and I'll invite my team later.

Now, you're going to name your first API key. We'll call this demo API key, and we'll add it to our default project and generate it. Now that I've got this, we're going to copy this and we're going to take this over to Postman.

Now in Postman, let's go to new and select AI. And from the drop-down menu, I'm going to choose GBT40. Let's go to the authorization tab, scroll down, and I'm going to paste the token that I just copied from OpenAI. Now, we'll go back to the prompt and we're going to ask, "Why is the sky blue?" We'll hit send. And there we have it. We've got our first API request coming back from OpenAI.

Now, this isn't always secure because I'm going to have to copy and paste my API key every time. So, let's secure this in the Postman vault. If in the bottom right-hand corner, I go to vault. I'm going to call this OpenAI API key and we'll paste my value. And then I'm going to go back over to my request. Then I go to the authorization tab and using the format double brackets and open AI key. Close it. And now I can send that again. And we'll see. Let's just say I'm going to change this and say you are a salty pirate, and we'll send that again just to make sure it's working. And sure enough, it's working.

Let's save all of this into a new collection. We'll call this open AI GPT 40. We'll name the collection my first AI call. All right, now that's saved.

Now, let's search the public API network for OpenAI APIs. Sure enough, we've got OpenAI and we'll fork this into our collection. Let's navigate to it. Make sure in our authorization we're using the correct vault. We'll save this. Now, let's navigate to the chat completions and just hit send. And there we have it. We've got a response coming back from OpenAI.

Boom. Just like that, you've gone from zero to making an actual API call. You've got your OpenAI key locked down in Postman's vault and sent your first request. The possibilities from here are limitless. We hope you found this helpful. If you did, hit that like and subscribe button for more AI and API content. Thanks for watching.