We may earn compensation from some listings on this page. Learn More

How to Get OpenAI API Key

By : Ankita

Aug 1, 2023

OpenAI API Key is a secret api key code that can identify your request to the API. Nowadays, a lot of applications demand users to provide an API Key to access new features and capabilities. This has led to a majority of users wondering how to get an OpenAI API Key. 

To get an OpenAI API Key, you need to visit the menu option on OpenAI, click on “View API Keys” and select “Create new secret key.” That’s it, and now you have your own Secret API Key. 

In this guide, we will provide you with a detailed guide on How to get an OpenAI API Key. Along with mentioning how to use the API Key, its pricing, usage, and much more. 

Is OpenAI API Key Free?

Yes, new users can create their OpenAI Key for free as they receive a $18 free credit. However, this credit is only available for the duration of three months. After this, you need to purchase credits to keep using OpenAI API. 

Where do I find my Secret OpenAI API Key?

You can find your Secret OpenAI API Key under the User Settings. You need to simply log in to your account on OpenAI’s page and click on the profile icon. Now, select “View API Keys” and you will find your Secret API Key. 

How to Get OpenAI API Key

To get an OpenAI API Key, you need to follow the below-mentioned steps: 

1. For this, you need first visit this URL https://openai.com/ and create an OpenAI account.

2. Click on “Sign Up” and provide your email details and password, complete the verification procedure by providing your phone number, and your OpenAI account is ready.

3. Now, you need to navigate to OpenAI Key Page using this URL https://platform.openai.com/account/api-keys 

4. Tap on the “Menu” bar and select “View API Key”.

5. Under the API Key option, select “Create new secret key” and your API Key will be generated.

Note: Once you have created your OpenAI API Key, you must keep it private. It is suggested to not share it with any colleague or friend to ensure privacy and security. 

How to Use Openai Api Key?

You can use OpenAI API Key for accessing a variety of models. For this, you need to authenticate your request to OpenAI API. On the HTTP Header of your request, you need to include your generated API Key.

Once done, your API Key has been authenticated and now you can begin accessing other models. You can visit OpenAI’s website and find a list of available models at the site that can perform several tasks. 

To make a request to OpenAI API, you have to specify the endpoint URL and then include all the important parameters. For example, to create a text using the GPT-3 model, you need to add your API key in the HTTP header along with any other essential parameters. 

Why do I need an OpenAI API key?

You need an OpenAI API key to access ChatGPT API and other OpenAI API models. An API Key works like an identifier that allows users to access other API models by OpenAI.

Through API Key users can also customize and fine-tune AI models. API Key also helps ensure your data and business remain secure and diminish the risk of authorized access.  

Do OpenAI API keys expire?

Yes, OpenAI API Key does have an expiration date after which the API Key is no longer available for usage. At times, the API Key might expire automatically if it hasn’t been used by the user for a while.

How much does OpenAI API Key Cost – Pricing in Words per Dollar

OpenAI API Key is charged depending on the monthly usage.

  • The charge for GPT-4 (8k Context) for 750 words (aka 1000 tokens) is $0.3.
  • The cost of GPT-4 (32k Context) for 1000 tokens is $0.06.
  • While the price of one of the most popular models GPT-3 (Davinci) for 1000 tokens is $0.02.
  • The charge for utilizing GPT-3.5 Turbo for 1000 tokens is $0.002 (which is 10 times cheaper than GPT-3).
  • Lastly, the price of utilizing Whisper (Audio) is $0.006 / minute. This way you will be charged based on the token you utilized a month. 

How to Fix “OpenAI Incorrect API Key Provided”

If you encounter the “OpenAI Incorrect API Key Provided” issue, while trying to use your API Key, then you should try following these methods: 

Clear Browsing data

Sometimes, your browser can hold up to an expired version of your API Key, which might cause an Incorrect API Key provided issue. Thus, it’s important to clear your cache, history and save passwords from your browser to get rid of this issue. Here’s how you can clear your browser cache and outdated data: 

Google Chrome

If you are accessing Google Chrome, then you need to follow these steps:

1. Tap on the three dots available on the right side.

2. Click on “More Tools” and select “Clear browsing data”.

3. Select the time range to “All time”.

4. Now click on “Clear browsing data”, “Cookies and other site data” and “Cached images and files”.

5. Select “Clear Data” and you’re done.

Firefox 

Here’s how you can clear your outdated files and cache from the Firefox browser: 

1. Tap on the three dots available on the right side.

2. Click on “Options”.

3. Select “Privacy and Security”.

4. Scroll down to “Cookies and Site Data”.

5. Tap on all three options “Clear Data”, “Cookies and Site Data” and “Cached Web Content” and that’s it.

Safari 

Here’s how you can clear cache and temporary files from the Safari browser: 

1. Tap on “Safari” from the menu bar.

2. Select “Preferences”.

3. Tap on “Privacy” and select “Manage Website Data”.

4. Now, you have to select “Remove All” in the options to get rid of the browser cache and outdated files.

Try accessing your API Key again 

Once you have cleared all the outdated files and cache from your browser. Try your request again and check if the API Key is working or not. 

Check your API key

If you are still facing the same error, even after clearing the cache from your browser. Then you should try checking your API Key on this website https://beta.openai.com and confirm it with the API key shown in the error.

At times, error messages can use an incorrect or old API key, which is expired or no longer available. Therefore, it’s important to double-check your entered key and ensure it’s correct. 

Verify you are using two separate API Keys 

There is a possibility the reason you are facing an “Incorrect API Key” error is that you might have used two different API Keys. Thus, you must recheck your entered API Key and ensure you are using the same API Key in your entire application. 

Contact OpenAI’s Support Team 

If you have tried all the above-mentioned methods and are still facing the “Incorrect OpenAI API Key provided” error. Then you need to contact OpenAI’s team and explain your issue. 

For this, you need to visit https://help.openai.com/ and click on the “bubble icon”. Now tap on “Messages” and explain your issue.  

What to Do If an OpenAI API Key Not Working?

If you are encountering issues like OpenAI API Key not working, then here are some tips that you should try:

Check your API Key 

The first thing you should do is try rechecking your API Key. Users tend to often face this error when users enter an incorrect API Key. Thus, you should check your API Key and try copying and pasting it again to ensure you are entering the correct API Key. 

Check OpenAI API’s status page 

At times, the issue can be from OpenAI’s side rather than yours. There is a possibility OpenAI API page might be down or facing a few issues. Therefore, you can try checking OpenAI API’s status page using this URL https://status.openai.com/

Check the Expiry date 

There is a possibility that your API Key has expired. If you are accessing API Key using your free credits, then you should know it’s only valid for three months. Thus, you need to further pay to continue accessing OpenAI API. So, you should check whether your API Key is expired or not. 

Check your usage

API Key has certain usage limits. If you are a regular API Key user then there are chances you have exceeded your usage limit. Therefore, it’s suggested you check your usage statistics to check whether you have hit the limit or not.

Check your billing information 

If you are accessing a paid version of OpenAI API, then you must keep your billing details updated. In case, your billing data is not updated, you will be unable to access your API Key.