How to Get an OpenAI API Key
Get started with building applications that leverage OpenAI's APIs and capabilities
When ChatGPT came out a few months ago, it gave a publicity boost to its maker: OpenAI. While very well known in more technical circles, the public release of ChatGPT transformed the interaction expectations of many users and made AI and OpenAI a common topic of conversation among technical and non technical users alike, all over the world.
OpenAI enables its users to develop on top of its platform, providing robust APIs for text generation and completion, image generation, fine tuning, and more. In order to take advantage of all of this though, you need an account and a free API key. In this article, we will show you how to get there.
Note: you don’t pay to create an API Key, but there are costs associated with using OpenAI’s API. You get 5$ of free credit to use in the first 3 months.
Create an OpenAI account
(Skip this section if you already have an account) If you don’t have an OpenAI account yet, go to https://platform.openai.com/signup and signup using your preferred method, and create either a company or individual account. Once you finish the registration process, you’ll have access to a dashboard where your can manage your account.
Create an API Key
Go to https://platform.openai.com and make sure your are logged in to your account.
On the top corner, you’ll see your avatar and “Personal” (or the company name). Click it and click again on “View API Keys” from the dropdown menu.
In the API Keys page, you’ll see a list of your existing API Keys (will be empty when you get there for the first time). Click the button “Create new secret key”.
A modal will pop-up and you’ll best asked to provide a name for your secret key. While not mandatory, it is recommended that you give it a name so that later on you can refer to it more easily (for example, if you create multiple keys to use in different applications).
Then, click on “Create secret key”. Once you do this, your secret key will be created and displayed to you right away in the same modal. ⚠️ Attention: as mentioned in the message from OpenAI, this is the only time you’ll be able to see the full key. As such, it is recommended you save this key somewhere else (as long as it is safe, like a password manager or encrypted and password protected file).
And that’s it! You made it. You now have an OpenAI API Key that you can use to interact with their platform.
What’s next
A few links that are useful as your first steps, so you can play around with the API and learn what it can do:
Documentation → Information about how the models work, what is possible to achieve and valuable examples.
API Reference → Technical documentation on how to use the API, including authentication, endpoints and more
Examples → A list of examples from OpenAI themselves, so you can learn by example
Playground → An easy way to test the models and generate code that you can then add to your applications